gnuplot line color


R

Rob Redmon

How do I choose the color used to make a gnuplot?

I'm doing something like:
def plot( output )
require 'gnuplot'
Gnuplot.open do |gp|
Gnuplot::plot.new( gp ) do |plot|

if ( output )
plot.terminal "png small"
plot.output "#{output}"
plot.pointsize 1
end

# plot.xrange "[#{@obs_times[0].to_s.gsub("T"," ")} to
#{@obs_times[0].to_s.gsub("T"," ")}]"
# plot.xrange
"[\"2009-01-01T00:00:00+00:00\":\"2009-01-01T23:59:00+00:00\"]"
plot.title "#{@header["element"].gsub("'","p")}"
plot.ylabel "#{@header["element"].gsub("'","p")}
[#{@header["units"]}]"
plot.xlabel "time: #{@obs_times.first} -
#{@obs_times.last}"
# plot.data << Gnuplot::DataSet.new( [ @obs_times, @data
] ) do |ds|
plot.data << Gnuplot::DataSet.new( [ @data ] ) do |ds|
ds.with = "lines"
ds.linewidth = 2
ds.notitle
end
plot.data << Gnuplot::DataSet.new( [ @data ] ) do |ds|
ds.with = "points"
ds.notitle
end
plot.grid
end
end
end

Presently this produces a plot that has green points on top of red line:
http://ngdc.noaa.gov/stp/IONO/ionosonde/MIDS/catalog/trends/BC840/BC840_fmin.png

I'd like to explicitly specify the colors and produce a black line with
blue points. How do I do that?
 
Ad

Advertisements

R

Rob Redmon

I've already tried piping through an "lt" command to DataSet like:

ds.linetype "rgb \"violet\""

But I get undefined method:

undefined method `lt' for #<Gnuplot::DataSet:0x1a7ca50>
(NoMethodError) from
/Library/Ruby/Gems/1.8/gems/gnuplot-2.2/lib/gnuplot.rb:181:in
`initialize'
 
R

Ralf Mueller

Rob said:
I've already tried piping through an "lt" command to DataSet like:

ds.linetype "rgb \"violet\""

But I get undefined method:

undefined method `lt' for #<Gnuplot::DataSet:0x1a7ca50>
(NoMethodError) from
/Library/Ruby/Gems/1.8/gems/gnuplot-2.2/lib/gnuplot.rb:181:in
`initialize'
try
ds.with "lt <gnuplot lt specification>"

at least this one worked for me ...


regards
ralf
 
Ad

Advertisements

R

Ralf Mueller

Ralf said:
try
ds.with "lt <gnuplot lt specification>"

at least this one worked for me ...


regards
ralf
eh...forgot the main attribute :(

ds.with = "lines lt <lt-spec>"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top