Hi. My name is Kensaku, and I am graduate school student.
Thank you for your rgplot, it is cool.
But... current rgplot could not use "set origin", because rgplot were separated by setting and dataset.
To fix this problem, I suggest that we include origin variable for variable class.
Sample Patch as follows.
-----------------------
141,142c141,142
< attr_accessor :title, :with, :using, :data, :linewidth, :matrix
<
---
> attr_accessor :title, :with, :using, :data, :linewidth, :matrix, :origin
>
153,156c153,156
<
< # Order of these is important or gnuplot barfs on 'em
<
< io << ( (@data.instance_of? String) ? @data : "'-'" )
---
> if @origin.class ==Array
> io<< "\nset origin "+sprintf("%f",@origin[0]) +", "+
sprintf("%f",@origin[1])+"\n"
> end
> # Order of these is important or gnuplot barfs on 'em
157a158
> io <<"plot "<< ( (@data.instance_of? String) ? @data : "'-'" )
168a170
> io << "\n"
------------------
And, sample code as follows ( this code were extended from your sample code).
-------------------
require '../lib/gnuplot'
# File.open( "gnuplot.dat", "w") do |gp|
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp,"" ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "x"
plot.xlabel "sin(x)"
plot.size "0.5" # add the this command
plot.multiplot # insert this command
x = (0..50).collect { |v| v.to_f }
y = x.collect { |v| v ** 2 }
plot.data = [
Gnuplot::DataSet.new( "sin(x)" ) { |ds|
ds.origin=[0.0,0.0] # add the this variable
ds.with = "lines"
ds.title = "String function"
ds.linewidth = 4
},
Gnuplot::DataSet.new( [x, y] ) { |ds|
ds.origin=[0.0,0.0] # add the this variable
ds.with = "linespoints"
ds.title = "Array data"
}
]
end
end
-------------------
English is my second language, and this is my first posting.
Please let up on some mistake. |