Gnuplot line color

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?

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’

Rob R. wrote:

try
ds.with "lt "

at least this one worked for me …

regards
ralf

Ralf M. wrote:

`initialize’

try
ds.with "lt "

at least this one worked for me …

regards
ralf

eh…forgot the main attribute :frowning:

ds.with = "lines lt "

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs