Dear all,

I have a problem displaying three-dimensional plots using ruby-gnuplot.

When I execute the code attached, a window opens up and displays

axes and axes labelling, but the actual graph does not appear.

It's not a fault of my gnuplot installation, as two-dimensional graphs

work out.

I suspect something is wrong with the Dataset specification,

but I don't know what.

Thank you in advance.

Best regards,

Axel

## ···

-----------------------------------------------------------------------

$verbose=nil

require "rubygems"

require "gnuplot"

include Math

Gnuplot.open do |gp|

Gnuplot::SPlot.new( gp ) do |plot|

plot.ticslevel 0

plot.pm3d 'map'

plot.palette 'defined (-3 "blue", 0 "white", 1 "red")'

plot.xrange "[-10:10]"

plot.yrange "[0:5]"

plot.zrange "[-3:1]"

x_min=-10.0

x_max=10.0

y_min=0.0

y_max=5.0

x=[x_min]

y=[y_min]

steps=10

for k in 0...steps

x<<(x_max-x_min)/steps.to_f

end

for k in 0...steps

y<<(y_max-y_min)/steps.to_f

end

z=[]

x.each{|x_v|

temp=[]

y.each{|y_v|

temp<<(2*sin(x_v)-1)*exp(-y_v)

}

z<<temp

}

plot.data << Gnuplot::DataSet.new( [x,y,z] ) do |ds|

ds.with = "pm3d"

ds.notitle

end

end

end