Changing the marks on a scatter plot?
-
- Posts: 23
- Joined: Mon Jul 06, 2009 12:59 pm
Changing the marks on a scatter plot?
I have a scatterplot that, right now, displays rectangles. Is there a way to change this to smaller dots? I can't seem to find any information regarding it.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Changing the marks on a scatter plot?
If you are using the XYLineAndShapeRenderer (it is the default) then you can:
(1) Call the setSeriesShape(...) method to change the shape that is displayed;
(2) Replace the renderer with an XYDotRenderer.
(1) Call the setSeriesShape(...) method to change the shape that is displayed;
(2) Replace the renderer with an XYDotRenderer.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 23
- Joined: Mon Jul 06, 2009 12:59 pm
Re: Changing the marks on a scatter plot?
Thanks, that's exactly the answer I needed!
Edit: Except one thing...how do I change the renderer used?
Edit: Except one thing...how do I change the renderer used?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Changing the marks on a scatter plot?
Code: Select all
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(new XYDotRenderer());
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 23
- Joined: Mon Jul 06, 2009 12:59 pm
Re: Changing the marks on a scatter plot?
Oh, that's simple. You thought of everything!
Re: Changing the marks on a scatter plot?
Is there a way to set or even get the current active shape of a series?
Are there DefaultShapes as like Color.BLUE which can be used?
Are there DefaultShapes as like Color.BLUE which can be used?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Changing the marks on a scatter plot?
If you rely on the defaults, they are assigned to the renderer the first time the chart is drawn, so it is tricky to find out the shapes until after the chart has been rendered (the renderer's getSeriesShape(int) method will return null prior to the first rendering). You *could* call lookupSeriesShape(int) which will do the default auto-populate for the shape if it hasn't already been done or disabled.DeO wrote:Is there a way to set or even get the current active shape of a series?
Are there DefaultShapes as like Color.BLUE which can be used?
Color.BLUE is not a shape, so I'm not quite sure what you meant by the second question.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

