Reputation: 61
Plot2DPanel plot = new Plot2DPanel();
Plot2DPanel plot1 = new Plot2DPanel();
plot.addScatterPlot("Error plot", Color.yellow, data1);
plot1.addScatterPlot("Error plot", Color.GREEN, data2);
// put the PlotPanel in a JFrame, as a JPanel
JFrame frame = new JFrame("a plot panel");
frame.setSize(600, 600);
frame.setContentPane(plot);
frame.setContentPane(plot1);
frame.setVisible(true);
I want to plot 2 scatterplots on the same graph. I tried to do it by the above code but it is not working. In output I am getting the scatterplot of data2 only. How can I do it?
Upvotes: 0
Views: 572
Reputation: 21
Please try adding both plots to the same Plot2DPanel
:
Plot2DPanel plot = new Plot2DPanel();
plot.addScatterPlot("Error plot", Color.yellow, data1);
plot.addScatterPlot("Error plot", Color.GREEN, data2);
Upvotes: 0