简体   繁体   中英

How do I get vertically stacked plots using JavaPlot?

How can I reproduce these vertically stacked plots, available in gnuplot:

set multiplot
set size 1, 0.5
set origin 0.0,0.5
plot sin(x), log(x)
set origin 0.0,0.0
plot sin(x), log(x), cos(x)
unset multiplot

From JavaPlot ( http://javaplot.panayotis.com/ )? I have searched for a JavaPlot multiplot example without success. My attempt below:

JavaPlot p = new JavaPlot();
p.set("multiplot", "");
p.set("size", "1, 0.5");
p.set("origin", "0.0,0.5");
p.addPlot("sin(x)");
p.addPlot("log(x)");
p.plot();
// p.newGraph();
p.set("multiplot", "");
p.set("size", "1, 0.5");
p.set("origin", "0.0,0.0");
p.addPlot("sin(x)");
p.addPlot("log(x)");
p.addPlot("cos(x)");
p.plot();

If I run the Java code as above I get a 'top plot' in one window and then a 'bottom plot' in another. If I uncomment p.newGraph(); and comment out p.plot(); I get horizontally stacked plots.

I have also tried using the multiplot layout command like those here http://gnuplot.sourceforge.net/demo/layout.html But not had any luck translating them into a call to JavaPlot.

Reading the JavaPlot documentation I suspect I need to do something with the GridGraphLayout class but can't work out what I'm supposed to do with it.

Thanks,

  • Khalid.

So I wasn't able to get this working within JavaPlot.

In case anyone else reaches this page and wants to use the same work-around I found producing vertically stacked plots, with shared x-axis, quite straightforward in Jfreechart. Some example code here:

CombinedDomainXYPlot not rescaling domain axis

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM