Graph 如何在ILNumerics中配置比例标签位置?

Graph 如何在ILNumerics中配置比例标签位置?,graph,label,axis,lines,ilnumerics,Graph,Label,Axis,Lines,Ilnumerics,我用伊利内普洛特画了几条线。 然后旋转立方体(旨在更改从顶部开始的Y比例标签的位置): 它会产生这样的结果。 在这个图中,我丢失了Y轴上的比例标签。如何配置它?那么标签可以显示吗 更新: 这个问题涉及: 首先,我制作了一个由一些线条组成的图表,如下图所示: 该数字由以下代码生成: scene.Add(new ILPlotCube { Children = { new ILLinePlot(ILMath.tosingle(responses["1,0;:"]),lineWid

我用伊利内普洛特画了几条线。

然后旋转立方体(旨在更改从顶部开始的Y比例标签的位置):

它会产生这样的结果。

在这个图中,我丢失了Y轴上的比例标签。如何配置它?那么标签可以显示吗

更新: 这个问题涉及:

首先,我制作了一个由一些线条组成的图表,如下图所示: 该数字由以下代码生成:

scene.Add(new ILPlotCube
{
   Children = {
      new ILLinePlot(ILMath.tosingle(responses["1,0;:"]),lineWidth:1, markerStyle: MarkerStyle.None),
      new ILLinePlot(line1, lineColor: Color.Black ,lineWidth: 2)
   },

   Axes =
   {
      YAxis =
      {
          LabelAnchor = new PointF(1, 0)
      },
      ZAxis = 
      {
         Visible = false,  
      }
   }
});

BoreholeRespondilPanel.Scene = scene;
BoreholeRespondilPanel.Refresh();
然后我想反转Y轴比例,变成这样:

根据这条线索:,他建议我将绘图立方体绕X轴旋转180°。这是我最后的代码:

scene.Add(new ILPlotCube
{
   Children = {
      new ILLinePlot(ILMath.tosingle(responses["1,0;:"]),lineWidth:1, markerStyle: MarkerStyle.None),
      new ILLinePlot(line1, lineColor: Color.Black ,lineWidth: 2)
   },
   Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif), //<<==== added this line

   Axes =
   {
      YAxis =
      {
          LabelAnchor = new PointF(1, 0)
      },
      ZAxis = 
      {
         Visible = false,  
      }
   }
});

BoreholeRespondilPanel.Scene = scene;
BoreholeRespondilPanel.Refresh();
scene.Add(新建ILPlotCube)
{
儿童={
新的ILLinePlot(ILMath.tosingle(响应[“1,0;:”]),线宽:1,markerStyle:markerStyle.None),
新的ILLinePlot(线条1,线条颜色:Color.Black,线条宽度:2)
},
Rotation=Matrix4.Rotation(新向量3(1,0,0),ILMath.pif),//编辑并使用解决方案创建新答案
经过一些调查,您的问题可能会被复制。实际上,我们有两个问题:

1) 旋转打印多维数据集以翻转轴是可以的。但应正确执行。这涉及旋转和平移。两者可以组合并应用于
ILPlotCube。旋转
属性:

Rotation = Matrix4.Translation(0, 0, -2).Rotate(Vector3.UnitX, ILMath.pif)
需要进行平移,因为旋转始终围绕原点进行。plotcube的原点位于(0,0,0)中,并且围绕X轴旋转会使plotcube更靠近摄影机。如果不进行平移,它可能会太近,以致ZNear上的剪辑会起作用,并阻止场景的某些部分显示

2) 但是ILNumerics
ILOGLabel
OpenGL label类在ILNumerics的4.1版之前存在一个错误,它将阻止标签显示在这样一个旋转的plotcube中。该错误将在4.1中修复。 为了解决这个错误

a、 使用
ILPlotCube.Transform
而不是
ILPlotCube.Rotation
,和
b、 重新配置
ILPlotCube.ZNear
ILPlotCube.ZFar
的设置:

plotCube.Transform = Matrix4.Translation(0, 0, -2).Rotate(Vector3.UnitX, ILMath.pif); 
plotCube.ZNear = -1; plotCube.ZFar = 1;
扼要重述 要使用ILNumerics版本>4.0反转Y轴,只需应用1即可。对于旧版本(4.0及以下),只需使用2)


旧答案 @编辑:旧答案并没有真正回答问题。请参阅上面的第一部分,以找到原始问题的解决方案。为了完整起见,此旧答案保留在此处,因为它无论如何都是有用的:它显示了如何通过允许用户交互来确保稳定的配置


我无法完全重现您的问题,但这里有一个潜在的解决方案

通过反转plot cube以在“上->下”方向获得Y轴,您必须确保用户无法通过双击场景来重置plot cube。我们可以处理双击事件并将旋转置于其中

无论如何,对于下面的这个例子,所有记号都正确显示。如果问题仍然存在,请发布一个屏幕截图和一个可运行的例子

private void ilPanel1_Load(object sender, EventArgs e) {
    // generate some test data
    ILArray<float> A = ILMath.tosingle(ILMath.randn(1, 20));
    ILArray<float> B = A + ILMath.vec<float>(1, 20);
    // add two lines
    ilPanel1.Scene.Add(new ILPlotCube {
        Children = {
            new ILLinePlot(A, lineWidth:1, markerStyle: MarkerStyle.None),
            new ILLinePlot(B, lineColor: Color.Black, lineWidth: 2)
        },
        // rotate the plotcube so the Y axis appears in top down direction
        Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif), //<<==== added this line

        // configure some axis label properties
        Axes = {
            YAxis = {
                LabelAnchor = new PointF(1, 0)
            },
            ZAxis = {
                Visible = false,
            }
        }
    });

    // override the double click event: resetting the plotcube will restore the reversed axis
    ilPanel1.Scene.First<ILPlotCube>().MouseDoubleClick += (_s, _a) => {
        var plotCube = _s as ILPlotCube;
        if (plotCube != null) {
            plotCube.Reset(); 
            plotCube.Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif);
            _a.Refresh = true;
            _a.Cancel = true; 
        }
    }; 
}
private void ilPanel1\u加载(对象发送方,事件参数e){
//生成一些测试数据
ILArray A=ILMath.tosingle(ILMath.randn(1,20));
ILArray B=A+ILMath.vec(1,20);
//添加两行
ilPanel1.Scene.Add(新ILPlotCube){
儿童={
新的ILLinePlot(A,线宽:1,标记样式:标记样式。无),
新ILLinePlot(B,线条颜色:彩色。黑色,线条宽度:2)
},
//旋转plotcube,使Y轴以自上而下的方向显示

Rotation=Matrix4.Rotation(新的Vector3(1,0,0),ILMath.pif),//请发布一个完整的小型运行示例。详细说明您试图实现的目标和观察到的结果。Thanks@HaymoKutschbach我已经更新了问题。
private void ilPanel1_Load(object sender, EventArgs e) {
    // generate some test data
    ILArray<float> A = ILMath.tosingle(ILMath.randn(1, 20));
    ILArray<float> B = A + ILMath.vec<float>(1, 20);
    // add two lines
    ilPanel1.Scene.Add(new ILPlotCube {
        Children = {
            new ILLinePlot(A, lineWidth:1, markerStyle: MarkerStyle.None),
            new ILLinePlot(B, lineColor: Color.Black, lineWidth: 2)
        },
        // rotate the plotcube so the Y axis appears in top down direction
        Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif), //<<==== added this line

        // configure some axis label properties
        Axes = {
            YAxis = {
                LabelAnchor = new PointF(1, 0)
            },
            ZAxis = {
                Visible = false,
            }
        }
    });

    // override the double click event: resetting the plotcube will restore the reversed axis
    ilPanel1.Scene.First<ILPlotCube>().MouseDoubleClick += (_s, _a) => {
        var plotCube = _s as ILPlotCube;
        if (plotCube != null) {
            plotCube.Reset(); 
            plotCube.Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif);
            _a.Refresh = true;
            _a.Cancel = true; 
        }
    }; 
}