【发布时间】:2013-11-05 09:36:32
【问题描述】:
我正在尝试用 Plot2DPanel 显示器上的字符串标签替换数字标签,但没有成功。
这是我使用数字 X 轴标签的图表:
这是我使用的代码:
// create your PlotPanel (you can use it as a JPanel)
Plot2DPanel plot = new Plot2DPanel();
// add the histogram (50 slices) of x to the PlotPanel
plot.addHistogramPlot("my plot", x);
// put the PlotPanel in a JFrame like a JPanel
JFrame frame = new JFrame("a plot panel");
frame.setSize(600, 600);
frame.setContentPane(plot);
frame.setVisible(true);
我尝试通过在 frame.setContentPane(plot); 之前添加此行来更改轴标签:
plot.getAxis(0).setStringMap(legend);
legend 是HashMap<String, Double>,将字符串标签映射到轴上的位置,但这不会改变绘图的任何内容。
我无法弄清楚我在这里缺少什么。任何建议将不胜感激!
谢谢!
凯维纳德
注意:如果有任何兴趣,我会通过 X11 转发从具有 groovy 的 gremlin shell 输出。
【问题讨论】: