Repository navigation
Providing support for multiplot #11
Description
Activity
looks like "not yet" though you can put multiple lines into a single graph: https://github.com/rdp/ruby_gnuplot/blob/master/examples/multiple_data_sets.rb
anything changed in this case?
I`am interested too, in multiple plots in one document.Maybe in hope to get attention to this one, I would also very much like support for multiplots.
I would like to put some work in trying to fix this, but I am fairly inexperienced with this kind of programming. Can someone maybe give me a few pointers for the steps which need to be taken?
Actually, I just discovered this is possible already. It is a bit of a work-around, because you have to set the multilayout in the first Gnuplot::Plot you define. The following works:
require '../lib/gnuplot' $VERBOSE = true Gnuplot.open do |gp| Gnuplot::Plot.new(gp) do |plot| plot.multiplot "layout 2,1" plot.xrange "[-10:10]" plot.title "Sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds| ds.with = "lines lc rgb 'blue'" ds.linewidth = 4 end end Gnuplot::Plot.new(gp) do |plot| plot.xrange "[-10:10]" plot.title "Second sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds| ds.with = "lines lc rgb 'green'" ds.linewidth = 4 end end end
Because this is a "global" Gnuplot setting, it would be better to have this implemented on the level of Gnuplot. The resulting class should probably have the methods method_missing, set and unset implemented, together with a
@settingslike Gnuplot::Plot does. Because this is quite a repetition, a nicer solution can be found than just copy the code, maybe?Note that any global setting can be provided this way. An other, very ugly, solution would be to direct insert command to the
gpobject:Gnuplot.open do |gp| gp << "set multiplot layout 2,1\n" Gnuplot::Plot.new(gp) do |plot| end end
Note the
\n.Reacted by Pranav Prakash, Junegunn Choi and Mikhail Chuprysnkinice :)
Is it possible to create multi plots?