I am currently trying to plot very small values for an allen variance plot. These values can range down to 1E-25. I am using a LogAxis for that, which does not work. Am I doing something wrong or is LogAxis not meant for those kind of values? If not, do you know of any alternatives?
Here is a small example. Make sure to include jcommon-1.0.16.jar and jfreechart-1.0.13.jar. I guess the version does not matter that much.
Code: Select all
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.LogAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
public class Demo {
public static void main(String[] args) {
XYSeries test = new XYSeries("Testdata");
double exp = -5, noiseExp = 2; // works as expected
// double exp = -15, noiseExp = 2; // does not show any values
for (double tau = 1E-8; tau < 1E-1; tau *= 2)
test.add(tau, Math.pow(10, exp + (Math.random() - 0.5) * noiseExp), false);
// test.add(tau, Math.pow(10, exp + (Math.random() - 0.5) * noiseExp) * 1E10, false); // with this, it works also for exp=1E-15
test.fireSeriesChanged();
JFreeChart chart = ChartFactory.createXYLineChart("", "", "", new XYSeriesCollection(test), PlotOrientation.VERTICAL, false, false, false);
chart.getXYPlot().setDomainAxis(new LogAxis("tau"));
chart.getXYPlot().setRangeAxis(new LogAxis("testdata"));
JFrame frame = new JFrame("plot");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.add(new ChartPanel(chart));
frame.setVisible(true);
frame.setSize(400, 300);
}
}
The following pictures show you the output. Left: working (exp=-5); Right: not working (exp=-15)


Any help would be appreciated.
Thanks a lot,
Stefan