0

全て、

RGB 色空間でいくつかの色の 3D プロットを作成しました。現在、マークはすべて同じ色です。それぞれのマークを空間で表す色にしたいと思います。したがって、プロットの赤い隅のマークは赤になるはずです...

私がこれまでに持っているコードは以下のとおりです。

ご協力いただきありがとうございます、

-明細書

// RGB color data for a few shades of pink and red

r = [1, 1, 1, 1, 0.8588235294117647, 0.7803921568627451, 1, 0.9803921568627451, 0.9137254901960784, 0.9411764705882353]';

g = [0.7529411764705882, 0.7137254901960785, 0.4117647058823529, 0.07843137254901961, 0.4392156862745098, 0.08235294117647059, 0.6274509803921569, 0.5019607843137255, 0.5882352941176471, 0.5019607843137255]';

b = [0.796078431372549, 0.7568627450980392, 0.7058823529411765, 0.5764705882352941, 0.5764705882352941, 0.5215686274509804, 0.4784313725490196, 0.4470588235294118, 0.4784313725490196, 0.5019607843137255]';

// Draw 3D graph from R G B vectors

param3d(r,g,b,35,45,"Red@Green@Blue",[2,4]);

title("Some Shades of Pink and Red");


// Set marks to ball style

p=get("hdl");

p.mark_style = 9;



// Turn lines off so we just have points

e = gce();

e.line_mode="off";

e.mark_mode="on";


// Set color map to our RGB values

cmap=[r g b];


// Put some code here to color each mark with its respective color
// I have no idea what to do at this point.
4

1 に答える 1

0

私の知る限り、ポリライン内のすべてのマークの mark_foreground 色を同じ色にしか設定できません。それはドキュメントでも確認されています。

手っ取り早い解決策は、マーカーごとにポリラインを作成して色を付けることです。より良い解決策は、表面プロットを実装することです。

実施例

私はあなたのコードに基づいて実用的な例を作成しましたが、それはきれいではなく、改善の余地がたくさんあります. しかし、それはあなたの直接の質問を解決します。

// RGB color data for a few shades of pink and red

r = [1, 1, 1, 1, 0.8588235294117647, 0.7803921568627451, 1, 0.9803921568627451, 0.9137254901960784, 0.9411764705882353]';

g = [0.7529411764705882, 0.7137254901960785, 0.4117647058823529, 0.07843137254901961, 0.4392156862745098, 0.08235294117647059, 0.6274509803921569, 0.5019607843137255, 0.5882352941176471, 0.5019607843137255]';

b = [0.796078431372549, 0.7568627450980392, 0.7058823529411765, 0.5764705882352941, 0.5764705882352941, 0.5215686274509804, 0.4784313725490196, 0.4470588235294118, 0.4784313725490196, 0.5019607843137255]';

// Draw 3D graph from R G B vectors

for i=1:length(r)
    param3d( r(i), g(i), b(i), 35,45,"Red@Green@Blue",[2,4]);

    if( i == 1 )
        title("Some Shades of Pink and Red");

        // Set color map to our RGB values
        cmap=[r g b];

        // Put some code here to color each mark with its respective color 

        //assign the colormap to the current figure
        f=gcf(); 
        f.color_map=cmap;
    end

    p=get("hdl");

    p.mark_style = 9;

    // Turn lines off so we just have points
    e = gce();
    e.line_mode="off";
    e.mark_mode="on";

    // Assign the mark color
    e.mark_foreground= i ;
end
于 2013-10-11T10:59:38.757 に答える