ilija
ilija

Reputation: 563

Graph Plot in JFreeChart

On the X axis my data points(20 of them) take values between 0 and 0.2. My X axis should have range from 0 to 1.
On the Y axis corresponding values are between 0.8 and 0.86. When I plot this graph using NumberAxis in JFreeChart I get very dense graph especially in the interval X belongs to 0.01 to 0.02.(so I can't see much)
Is it meaningful to use log scale for X axis in this case? How should I adjust LogAxis in JFreeChart here?

Upvotes: 0

Views: 414

Answers (2)

trashgod
trashgod

Reputation: 205785

To use LogAxis, just create the axis and set it as the plot's domain:

LogAxis xAxis = new LogAxis("X");
plot.setDomainAxis(xAxis);

LogAxisDemo1, shown among the XY Charts in the demo, is a complete example. LogarithmicAxis may be a more visually appealing alternative.

Upvotes: 1

Meng Lu
Meng Lu

Reputation: 14626

Using log scale for x-coordinates is sensible. One approach without trying to figure out the right syntax for LogAxis is to transform the data points from {x, y} to {log(x), y} and use the normal linear scale charting.

Upvotes: 0

Related Questions