Re: ruby/gnuplot on windows

I don’t know about persist flags, but as a quick-and-dirty solution,
you
could either use something like the ‘pause’ Gnuplot command:

pause 10

or

pause -1 “Hit any key to continue”

(pause 10 will hold the graph for 10 seconds etc.) or you could have
the
plot exported directly to postscript format,
so you can see it using ghostview, using the following Gnuplot
commands.

set terminal postscript enhanced color
set output “my_nice_plot.eps”
plot sin(x)

Best regards,

Axel

PS. For the use of Gnuplot, here is a very nice description/tutorial:

_http://t16web.lanl.gov/Kawano/gnuplot/index-e.html_
(http://t16web.lanl.gov/Kawano/gnuplot/index-e.html)

unknown wrote:

I don’t know about persist flags, but as a quick-and-dirty solution,
you
could either use something like the ‘pause’ Gnuplot command:

pause 10

or

pause -1 “Hit any key to continue”

(pause 10 will hold the graph for 10 seconds etc.) or you could have
the
plot exported directly to postscript format,
so you can see it using ghostview, using the following Gnuplot
commands.

set terminal postscript enhanced color
set output “my_nice_plot.eps”
plot sin(x)

Best regards,

Axel

Thanks, I’ll try that out. I’m sure this problem with the persist flag
will still eat at me though.

-j

PS. For the use of Gnuplot, here is a very nice description/tutorial:

_http://t16web.lanl.gov/Kawano/gnuplot/index-e.html_
(http://t16web.lanl.gov/Kawano/gnuplot/index-e.html)

On Wed, 17 May 2006, Jon D. wrote:

Best regards,

Axel

Thanks, I’ll try that out. I’m sure this problem with the persist flag
will still eat at me though.

how are you running the examples? using ruby, rubyw, from console, etc?

what happens if you do

dos prompt> irb

irb prompt> load ‘plot_example.rb’

??

-a

unknown wrote:

On Wed, 17 May 2006, Jon D. wrote:

Best regards,

Axel

Thanks, I’ll try that out. I’m sure this problem with the persist flag
will still eat at me though.

how are you running the examples? using ruby, rubyw, from console, etc?

what happens if you do

dos prompt> irb

irb prompt> load ‘plot_example.rb’

??

-a

I’m running the example from the command line: C:…>ruby
plot_example.rb. Same thing when I run it through irb. I get a return
of true and a quick flash of the graph.

-j

I’ve never used this particular ruby-gnuplot library, but the following
works for me with gnuplot 4.0:

C:\prj\gnuplot\bin>irb
irb(main):001:0> gp = “pgnuplot”
=> “pgnuplot”
irb(main):002:0> pi = IO.popen(gp, “w”)
=> #IO:0x2c20c00
irb(main):003:0> pi.puts “plot sin(x)”
=> nil

The plot window stays up and lets you manipulate it with the mouse. Just
keep the pipe open.

One small advantage of windows gnuplot is that if you go to the window
menu (?) in the upper left corner, and select “options”, you can print
and do other neat stuff.

My experience was that the -persist flag wasn’t necessary on windows.

Jon D. wrote:

unknown wrote:

On Wed, 17 May 2006, Jon D. wrote:

Best regards,

Axel

Thanks, I’ll try that out. I’m sure this problem with the persist flag
will still eat at me though.

how are you running the examples? using ruby, rubyw, from console, etc?

what happens if you do

dos prompt> irb

irb prompt> load ‘plot_example.rb’

??

-a

I’m running the example from the command line: C:…>ruby
plot_example.rb. Same thing when I run it through irb. I get a return
of true and a quick flash of the graph.

-j

I’ve been able to get the graph to export, but the pause command doesn’t
seem to want to work. I still can’t figure out the persist problem.

-j

Joel VanderWerf wrote:

I’ve never used this particular ruby-gnuplot library, but the following
works for me with gnuplot 4.0:

C:\prj\gnuplot\bin>irb
irb(main):001:0> gp = “pgnuplot”
=> “pgnuplot”
irb(main):002:0> pi = IO.popen(gp, “w”)
=> #IO:0x2c20c00
irb(main):003:0> pi.puts “plot sin(x)”
=> nil

The plot window stays up and lets you manipulate it with the mouse. Just
keep the pipe open.

One small advantage of windows gnuplot is that if you go to the window
menu (?) in the upper left corner, and select “options”, you can print
and do other neat stuff.

My experience was that the -persist flag wasn’t necessary on windows.

What download of gnuplot 4.0 for windows did you use? I used the
gp400win32.zip which didn’t have a bin directory. I ran the same
command through irb and it works like you said because its in
interactive mode. I also don’t appear to have a window menu. Is that
in the graph window or the command line window? Maybe the download
wasn’t good. Anyway, I would like to run scripts through the command
line and not enter it each time through irb. That way, the persist flag
becomes necessary but I can’t get it to work. Thanks for the help.

-j

Joel VanderWerf wrote:

Jon D. wrote:

=> nil
What download of gnuplot 4.0 for windows did you use? I used the
gp400win32.zip which didn’t have a bin directory. I ran the same

Odd, gp400win32.zip is what I downloaded yesterday, and it does seem to
have a bin dir. This is what it unpacks to:

bin contrib demo install readme README.Windows
bugs Copyright docs news readme.1st

command through irb and it works like you said because its in
interactive mode. I also don’t appear to have a window menu. Is that
in the graph window or the command line window? Maybe the download
wasn’t good. Anyway, I would like to run scripts through the command
line and not enter it each time through irb. That way, the persist flag
becomes necessary but I can’t get it to work. Thanks for the help.

Oh, you mean you want the gnuplot window to outlive the ruby process
that sent it commands? I don’t know of any way to do that on windows,
short of writing a socket-listening wrapper around pgnuplot (drb would
be helpful).

The window menu I’m talking about should be in the upper left corner of
the plot window.

I didn’t have any folders in the download. Strange, I’ll download it
again and see what I get. The weird thing with the plot window closing
is that if I run a script file with pure gnuplot (not through ruby),
the window should stay open with the -persist option entered on the
command line and it doesn’t. I can’t get the pause command to work
either which should hold the window open after the file executes. I’ll
download the .zip file again and let you know what happens.

I’m not getting a window menu in the plot menu. Strange.

-j

Jon D. wrote:

=> nil
What download of gnuplot 4.0 for windows did you use? I used the
gp400win32.zip which didn’t have a bin directory. I ran the same

Odd, gp400win32.zip is what I downloaded yesterday, and it does seem to
have a bin dir. This is what it unpacks to:

bin contrib demo install readme README.Windows
bugs Copyright docs news readme.1st

command through irb and it works like you said because its in
interactive mode. I also don’t appear to have a window menu. Is that
in the graph window or the command line window? Maybe the download
wasn’t good. Anyway, I would like to run scripts through the command
line and not enter it each time through irb. That way, the persist flag
becomes necessary but I can’t get it to work. Thanks for the help.

Oh, you mean you want the gnuplot window to outlive the ruby process
that sent it commands? I don’t know of any way to do that on windows,
short of writing a socket-listening wrapper around pgnuplot (drb would
be helpful).

The window menu I’m talking about should be in the upper left corner of
the plot window.