【发布时间】:2013-12-17 09:38:31
【问题描述】:
我想创建一个正态分布图,上面有多条线。
一模一样:
我搜索了互联网,但只找到了一些常用折线图的指南,而不是正态分布图。
我不知道怎么做,请帮忙
以下是我的部分代码
public ChartPanel getPanelNormalWeightAndSpecies() {
double mean = getMean();
double std = getStd(mean);
Function2D normal = new NormalDistributionFunction2D(mean, std);
Function2D normal2 = new NormalDistributionFunction2D(0.0, 1.0);
XYDataset dataset = DatasetUtilities.sampleFunction2D(normal, 50, 150, 100, "Normal");
XYDataset dataset2 = DatasetUtilities.sampleFunction2D(normal2, 50, 150, 100, "Normal2");
JFreeChart chart = ChartFactory.createXYLineChart(
"Test",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = chart.getXYPlot();
XYItemRenderer xyitem = plot.getRenderer();
plot.setDataset(1, dataset2);
plot.setRenderer(1, xyitem);
ChartPanel chartPanel = new ChartPanel(chart);
return chartPanel;
}
【问题讨论】:
标签: java jfreechart