如何在 ILNumerics 中配置刻度标签位置?

2024-03-15

I draw some lines with ILLinePlot. enter image description here

然后我旋转立方体(目的是更改从顶部开始的 Y 刻度标签的位置):

Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif),

It produces results like this. enter image description here

在此图中,我丢失了 Y 轴上的刻度标签。如何配置呢?那么标签可以显示吗?

Update:这个问题与:如何反转 ILNumerics 中的轴 https://stackoverflow.com/questions/24502759/how-to-reverse-the-axis-in-ilnumerics

At first, I have make a graph that consists some lines like this figure: enter image description here That figure is produced by this code:

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();

Then I want to reverse the Y axis scale become like this: enter image description here

从这个线程:如何反转 ILNumerics 中的轴 https://stackoverflow.com/questions/24502759/how-to-reverse-the-axis-in-ilnumerics,他建议我将绘图立方体绕 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();

但是,结果缺少 Y 轴上的刻度标签。如何配置才能显示刻度标签?


编辑和新答案与解决方案

经过一番调查后,您的问题可能会重现。实际上我们有两个问题:

1)旋转绘图立方体以翻转轴就可以了。但应该正确地进行。这涉及到一个旋转and一个翻译。两者可以组合并一起应用于ILPlotCube.Rotation财产:

Rotation = Matrix4.Translation(0, 0, -2).Rotate(Vector3.UnitX, ILMath.pif)

需要平移,因为旋转总是围绕原点进行。绘图立方体的原点位于 (0,0,0),绕 X 轴旋转使绘图立方体更靠近相机。如果没有平移,它可能会太接近,从而导致 ZNear 上的剪辑启动并阻止场景的某些部分显示。

2) BUTILNumerics 中存在错误ILOGLLabelILNumerics 的 OpenGL 标签类先前版本 4.1 将阻止标签在此类旋转的绘图立方体中显示。该错误将在 4.1 中修复。 为了解决这个错误,

a. Use ILPlotCube.Transform代替ILPlotCube.Rotation, and
b.重新配置设置ILPlotCube.ZNear and ILPlotCube.ZFar:

plotCube.Transform = Matrix4.Translation(0, 0, -2).Rotate(Vector3.UnitX, ILMath.pif); 
plotCube.ZNear = -1; plotCube.ZFar = 1;

Recap

要使用 ILNumerics 版本 > 4.0 反转 Y 轴,只需应用 1)。对于旧版本(4.0 及以下),只需使用 2)。


旧答案

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


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

通过反转绘图立方体以获得从上到下方向的 Y 轴,您必须确保用户无法通过双击场景来重置绘图立方体。我们可以处理双击事件并将旋转放在那里。

无论如何,对于下面的示例,所有刻度都正确显示。如果问题仍然存在,请发布屏幕截图和runnable例子。

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; 
        }
    }; 
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 ILNumerics 中配置刻度标签位置? 的相关文章

  • matplotlib 中刻度线的方向

    有没有办法使用 matplotlib 使 xaxis 底部刻度线的方向指向外 但顶部的刻度线指向内 是的 您可以使用 set tick params 方法来执行此操作 这是设置直方图以按照您的描述工作的示例 hist xaxis set t
  • 如何将共现矩阵转换为 networkx 图

    我正在使用以下代码将列表列表转换为共现矩阵 lst a b b c d e a d b e u pd get dummies pd DataFrame lst prefix prefix sep groupby level 0 axis 1
  • 拖动滑块时更新标签

    我正在使用一个Slider在我的 javaFX 项目中 我有一个Label当我移动滑块时它会更新 我想要Label在我拖动时进行更新Slider不仅是当阻力被放下时 这是我的代码 betSlider valueChangingPropert
  • 图库的 xml 树解析器 (Haskell)

    我正在编写一个用于处理图形的库 主要任务 解析 xml tree 这棵树看起来像
  • WSDLException:尝试解析引用的架构时发生错误

    我正在尝试使用 windows xp 上的 eclipse Galileo 和 axis 2 1 4 从本地 WSDL 文件生成代理类 我的问题是 由于 WSDL 中导入的架构 我收到错误 令我烦恼的是
  • 将边权重传递给networkx中的graphviz_layout

    每个人都找不到如何将权重列表的属性名称传递给networkx中的graphviz layout 像这样的事情 nx spring layout G weight weight sum 但与nx graphviz layout G 也许有人会
  • D3:打字机风格的文本过渡

    In this jsfiddle http jsfiddle net VividD QbysN 标签通过减小旧文本的字体 然后增加新文本的字体 从一个文本过渡到另一个文本 但是 我希望新文本以 打字机 方式出现 就像这样jsfiddle h
  • R/Javascript:崩溃和扩展的网络

    我正在使用 R 编程语言 我有以下图形网络数据 library igraph library visNetwork from lt c Boss TeamA TeamA TeamA SubteamA1 SubteamA1 SubteamA1
  • igraph (R) 中仅在根和终端顶点上添加标签?

    inst2 c 2 3 4 5 6 motherinst2 c 7 8 2 10 11 km c 20 30 40 25 60 df2 data frame inst2 motherinst2 df2 cbind df2 km g2 gra
  • 在 Python 中使用邻接表构建节点图

    我有一个Node类如下 class Node def init self val 0 neighbors None self val val self neighbors neighbors if neighbors is not None
  • 在Python中单击按钮时隐藏标签

    在 Python Tkinter 中单击按钮时如何隐藏现有标签 这实际上取决于您使用的几何管理器 如果你使用 lbl Tkinter Label parent 要创建标签 您将使用以下方法之一来隐藏它 lbl grid forget lbl
  • boost::property_map 在 boost 中是如何实现的以及如何更改它

    我想知道属性映射是如何在提升图中实现的 例如 我的顶点和边属性定义如下 vertex property gt struct NodeInfo int a b c actual bundled property struct NodeInfo
  • Ant javac 任务出错:[javac] 警告:[选项] 引导类路径未与 -source 1.6 一起设置

    我正在尝试运行一个使用的 ant 任务axis2 ant plugin 1 6 0 jar org apache axis2 tool ant AntCodegenTask执行一个WSDL2Java手术 在ant脚本的顶部 我定义了java
  • Visual Studio 项目的依赖关系图

    我目前正在将一个大型解决方案 约 70 个项目 从 VS 2005 NET 2 0 迁移到 VS 2008 NET 3 5 目前我有 VS 2008 NET 2 0 问题是我需要将项目一一移动到新的 NET 框架 确保没有 NET 2 0
  • .NET(或 MFC)的高速图形控件?

    我需要编写一个数字示波器类型的应用程序 有很多很棒的静态绘图控件 但我需要一些可以绘制每秒处理 4000 个样本的 16 条轨迹的东西 有人知道 NET 的高速图形控件吗 我什至会选择 MFC 因为它可以封装到 NET 控件中 谢谢您的帮助
  • 参数映射不能用于 MERGE 模式

    我收到错误参数映射不能在合并模式中使用 我如何解决此错误 我正在使用下面的代码 我非常感谢任何帮助 提前致谢 MERGE u Person names RETURN u and data2 names name Keanu Reeves1
  • R中一张图中的多个条形图

    我是 R 初学者 我需要创建一个像这样的图表 https i stack imgur com az56z jpg https i stack imgur com az56z jpg 我不知道如何生成整个数据集 基本思想是某个外显子 ID 会
  • Javascript 3d 绘图实用程序? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 有谁知道有什么好的 javascript 3d 绘图实用程序吗 我知道每个网站都推荐过画布 3d 图
  • 用于带有嵌套子图的图的 r 包? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我正在寻找一个用于图形 网络的 r 包 它可以处理嵌套子图 Graphviz 做到了这一点 但只提供可
  • Bokeh 中单独的节点和边缘悬停工具?

    我正在尝试为 Bokeh 中的节点和边缘获取单独的悬停工具提示 但未能使其正常工作 有人可以指出我做错了什么吗 我相信代码应该如下所示 from bokeh io import show output notebook from bokeh

随机推荐