1

I plot multiple surfaces in one plot cube. But I cannot make them to have the same color bar. I have defined an ILColorbar and added them to the surfaces but it plots two color bars with different numbers. Is it possible for the both surfaces to have the same color bar? Moreover, how can I add text to the color bar (title, labels)? Thank you very much. Here is an example:

    private void ilPanel1_Load(object sender, EventArgs e)
    {
        var scene = new ILScene();
        // add a new plot cube 
        var pc = scene.Add(new ILPlotCube());
        pc.TwoDMode = false;
        // Create Data
        ILArray<float> A = ILSpecialData.torus(0.75f, .25f);
        ILArray<float> B = ILSpecialData.torus(3.0f, .65f);
        // Add the surface
        var sf1 = new ILSurface(A);
        var sf2 = new ILSurface(B);

        pc.Add(sf1);
        pc.Add(sf2);
        sf1.Colormap = Colormaps.Jet;
        sf2.Colormap = Colormaps.Jet;

        var cb = new ILColorbar();
        sf1.Add(cb);
        sf2.Add(cb);
        ilPanel1.Scene = scene;
    }

enter image description here

4

1 回答 1

2

让他们使用相同的DataRange. 我UpdateColormapped()在表面上使用以提供相同的Tuple<float,float>. 这告诉他们要使用颜色图中的哪些颜色。由于某些原因,我无法使用相应的ILSurface构造函数。这可能是一个错误?(在这种情况下应该有人提出问题吗?)

颜色条像任何其他对象一样被修改:您可以以常规方式向其添加新的形状/标签。使用该Padding属性,以便为您的标签腾出更多空间:

private void ilPanel1_Load(object sender, EventArgs e) {
    var scene = new ILScene();
    // add a new plot cube 
    var pc = scene.Add(new ILPlotCube(twoDMode:false));

    // Create Data
    ILArray<float> A = ILSpecialData.torus(0.75f, .25f);
    ILArray<float> B = ILSpecialData.torus(3.0f, .65f);
    // Add the surfaces
    var cdr = Tuple.Create<float,float>(-0.6f, 0.6f);  
    var sf1 = new ILSurface(0);
    var sf2 = new ILSurface(0);
    // provide the same datarange to both surfaces
    sf1.UpdateColormapped(A, dataRange: cdr);
    sf2.UpdateColormapped(B, dataRange: cdr);

    pc.Add(sf1);
    pc.Add(sf2);
    sf1.Colormap = Colormaps.Jet;
    sf2.Colormap = Colormaps.Jet;

    var cb = new ILColorbar() {
        Padding = new SizeF(10,30),
        Children = {
            new ILLabel("Title") {
                Position = new Vector3(.5f,.1f,0),
                Anchor = new PointF(.5f,.7f),
                Font = new Font(DefaultFont, FontStyle.Bold)
            },
            new ILLabel("Label") {
                Position = new Vector3(.12f,.5f,0),
                Rotation = -Math.PI / 2,
            }
        }
    };
    sf1.Add(cb);
    ilPanel1.Scene = scene;
}

具有绘图立方体和自定义数据范围的环面

您可能知道这样一个事实,即您根本不必使用绘图立方体?如果我们在下面添加圆环,scene.Camera我们会得到一个没有失真的圆环:

无畸变的环面

于 2014-01-14T23:07:30.660 回答