Quantcast

Gnuplot scripts as output?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Gnuplot scripts as output?

forkandwait
Hi

Is there a way to get the gnuplot commands issued by octave when calling the
octave plot functions?  Ideally in a file for later perusal.

Best.

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

c.-2

On 24 Mar 2010, at 15:20, forkandwait wrote:

> Hi
>
> Is there a way to get the gnuplot commands issued by octave when  
> calling the
> octave plot functions?  Ideally in a file for later perusal.
>
> Best.

yes I think it's something like:

drawnow ("x11", "/dev/null", false, "gnuplotstream.gp")

see 'help drawnow'
c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

Tribo Laboy
On Wed, Mar 24, 2010 at 6:08 PM, Carlo de Falco <[hidden email]> wrote:

>
> On 24 Mar 2010, at 15:20, forkandwait wrote:
>
>> Hi
>>
>> Is there a way to get the gnuplot commands issued by octave when
>> calling the
>> octave plot functions?  Ideally in a file for later perusal.
>>
>> Best.
>
> yes I think it's something like:
>
> drawnow ("x11", "/dev/null", false, "gnuplotstream.gp")
>
> see 'help drawnow'
> c.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


Hello!

I am also quite interested in the possibility to reuse gnuplot files
created by octave.

On my windows version of Octave 3.2.3-2 from source-forge coming with
gnuplot  4.3.0-2009-07-08 CVS patchlevel 0 octave-mingw32 I do the
following:

x = 0:0.1:16; y = sin(x);
plot(x,y)
drawnow ("windows", "NUL", false, "gnuplotstream.plt")

as a result I get a "gnuplotstream.plt" file in the current dir, but
when trying to open it in gnuplot, it does nothing. No error, nothing.
I open the file in a text editor a found that some of the data is
binary. Could that be the problem?

I would appreciate if someone sheds some light on this. Does it work
on Linux and how to make it work on Win?

Regards

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

bpabbott
Administrator
On Apr 1, 2010, at 7:02 AM, Tribo Laboy wrote:

> On Wed, Mar 24, 2010 at 6:08 PM, Carlo de Falco <[hidden email]> wrote:
>>
>> On 24 Mar 2010, at 15:20, forkandwait wrote:
>>
>>> Hi
>>>
>>> Is there a way to get the gnuplot commands issued by octave when
>>> calling the
>>> octave plot functions?  Ideally in a file for later perusal.
>>>
>>> Best.
>>
>> yes I think it's something like:
>>
>> drawnow ("x11", "/dev/null", false, "gnuplotstream.gp")
>>
>> see 'help drawnow'
>> c.
>
> Hello!
>
> I am also quite interested in the possibility to reuse gnuplot files
> created by octave.
>
> On my windows version of Octave 3.2.3-2 from source-forge coming with
> gnuplot  4.3.0-2009-07-08 CVS patchlevel 0 octave-mingw32 I do the
> following:
>
> x = 0:0.1:16; y = sin(x);
> plot(x,y)
> drawnow ("windows", "NUL", false, "gnuplotstream.plt")
>
> as a result I get a "gnuplotstream.plt" file in the current dir, but
> when trying to open it in gnuplot, it does nothing. No error, nothing.
> I open the file in a text editor a found that some of the data is
> binary. Could that be the problem?
>
> I would appreciate if someone sheds some light on this. Does it work
> on Linux and how to make it work on Win?
>
> Regards

>From gnuplot, type ...

        load "gnuplotstream.plt"

If that doesn't work, I recommend you ask for help from one of the many options at the link below.

        http://www.gnuplot.info/help.html

Ben

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

martin_helm
In reply to this post by Tribo Laboy
Am Donnerstag, 1. April 2010 13:02:49 schrieb Tribo Laboy:

>
> Hello!
>
> I am also quite interested in the possibility to reuse gnuplot files
> created by octave.
>
> On my windows version of Octave 3.2.3-2 from source-forge coming with
> gnuplot  4.3.0-2009-07-08 CVS patchlevel 0 octave-mingw32 I do the
> following:
>
> x = 0:0.1:16; y = sin(x);
> plot(x,y)
> drawnow ("windows", "NUL", false, "gnuplotstream.plt")
>
> as a result I get a "gnuplotstream.plt" file in the current dir, but
> when trying to open it in gnuplot, it does nothing. No error, nothing.
> I open the file in a text editor a found that some of the data is
> binary. Could that be the problem?
>
> I would appreciate if someone sheds some light on this. Does it work
> on Linux and how to make it work on Win?
>
> Regards

I cannot tell you how to make it work with windows. I only wanted to tell you
that it works well in linux.

tested with opensuse 11.2 64 bit and octave 3.2.4, gnuplot 4.2 p5

of course I had to set terminal to x11.

x = 0:0.1:16; y = sin(x);
plot(x,y)
drawnow ("X11", "NUL", false, "gnuplotstream.plt")

and in gnuplot

   load "gnuplotstream.plt"

- mh
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

tmacchant
In reply to this post by Tribo Laboy
Hello

--- Tribo Laboy  wrote:

> Hello!
>
> I am also quite interested in the possibility to reuse gnuplot files
> created by octave.
>
> On my windows version of Octave 3.2.3-2 from source-forge coming with
> gnuplot  4.3.0-2009-07-08 CVS patchlevel 0 octave-mingw32 I do the
> following:
>
> x = 0:0.1:16; y = sin(x);
> plot(x,y)
> drawnow ("windows", "NUL", false, "gnuplotstream.plt")
>
> as a result I get a "gnuplotstream.plt" file in the current dir, but
> when trying to open it in gnuplot, it does nothing. No error, nothing.
> I open the file in a text editor a found that some of the data is
> binary. Could that be the problem?
>
> I would appreciate if someone sheds some light on this. Does it work
> on Linux and how to make it work on Win?

Gnuplot for window seems not to accept the binary data like

plot "-" binary format='%float64' record=161 using ($1):($2) axes x1y1 title "" with lines linestyle 1
\
;
(binary data)

by load command.

However,
After the following

x = 0:0.1:16; y = sin(x);
plot(x,y)
drawnow ("windows", "NUL", false, "gnuplotstream.plt")
close

Type
system('cmd')

and then goto command prompt of cmd.
At the command prompt

copy gnuplotstream.plt tmp.plt
echo pause 5 >> tmp.plt
type tmp.plt | gnuplot
del tmp.plt

worked.  (I have confirmed octave-3.2.4/mingw32)

The 'pause 5' means 5 seconds wait.  Please change it as you like.
Do not use 'pause -1' because one cannot send 'enter' code interactively via pipe.


The below is a screen shot as an example

*******************************************
octave:7> x = 0:0.1:16; y = sin(x);
octave:8> plot(x,y)
octave:9> drawnow ("windows", "NUL", false, "gnuplotstream.plt")
octave:10> close
octave:11> system('cmd')
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\usr\Tatsu\program\Octave\test2>copy gnuplotstream.plt tmp.plt
        1 file(s) copied.

D:\usr\Tatsu\program\Octave\test2>echo pause 5 >> tmp.plt

D:\usr\Tatsu\program\Octave\test2>type tmp.plt | gnuplot

D:\usr\Tatsu\program\Octave\test2>del tmp.plt

D:\usr\Tatsu\program\Octave\test2>
*******************************

Hope the above helps

Good luck!!

Tatsuro

--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

tmacchant
Hello

--- Tatsuro MATSUOKA wrote:

>
> Gnuplot for window seems not to accept the binary data like
>
> plot "-" binary format='%float64' record=161 using ($1):($2) axes x1y1 title "" with lines
> linestyle 1
> \
> ;
> (binary data)
>
> by load command.

I have reported the above issue of gnuplot for windows to SourceForge bug tracker of the gnuplot team.

BTW, I have confirmed that gnuplot on cygwin script which includes plot '-' with binary data works
correct.

Regards

Tatsuro

--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

tmacchant
Hello

--- Tatsuro MATSUOKAwrote:

>
> I have reported the above issue of gnuplot for windows to SourceForge bug tracker of the gnuplot
> team.

The url is
http://sourceforge.net/tracker/?func=detail&atid=102055&aid=2981027&group_id=2055


--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

Tribo Laboy
Dear Tatsuro,

Thanks a lot for your help. I tried your example and it does work
through the pipe. I guess, if I want to output it to different
terminal now (e.g. eps, svg, etc.) I should add the appropriate lines
in the 'plt' file. I am interested in being able to save the plots,
because in that way they can be easily exchanged with people who don't
have Octave or Matlab. Currently I most often exchange plots and data
with colleagues in Excel, but that is for me doing the same work
twice.

Regarding the exchange of plots, it would be helpful if there was a
mechanism of saving the gnuplot file generated by Octave with human
readable text data instead of the current binary. The receiver could
use gnuplot directly or cut and paste into his favorite plotting
program. Based on the information in this thread I am willing to write
a function to do that, but I need some help with the conversion of the
binary-to-text. Anyone who can tell me how to do that?

Thanks


2010/4/2 Tatsuro MATSUOKA <[hidden email]>:

> Hello
>
> --- Tatsuro MATSUOKAwrote:
>
>>
>> I have reported the above issue of gnuplot for windows to SourceForge bug tracker of the gnuplot
>> team.
>
> The url is
> http://sourceforge.net/tracker/?func=detail&atid=102055&aid=2981027&group_id=2055
>
>
> --------------------------------------
> Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
> http://pr.mail.yahoo.co.jp/ie8/
>
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

tmacchant
Hello

--- Tribo Laboy  wrote:

> Dear Tatsuro,
>
> Thanks a lot for your help. I tried your example and it does work
> through the pipe. I guess, if I want to output it to different
> terminal now (e.g. eps, svg, etc.)

If you want to generate the eps and svg file, you can use print command.

x=linspace(0,2*pi,101); y=sin(x);
plot(x,y);
print('sin.eps','-deps');

See 'help print' in detail.

>I should add the appropriate lines
> in the 'plt' file. I am interested in being able to save the plots,
> because in that way they can be easily exchanged with people who don't
> have Octave or Matlab. Currently I most often exchange plots and data
> with colleagues in Excel, but that is for me doing the same work
> twice.

To use data in other software like Excel, you need not use plot command.

data =[x' y']
save -ascii xy.dat data


> Regarding the exchange of plots, it would be helpful if there was a
> mechanism of saving the gnuplot file generated by Octave with human
> readable text data instead of the current binary. The receiver could
> use gnuplot directly or cut and paste into his favorite plotting
> program. Based on the information in this thread I am willing to write
> a function to do that, but I need some help with the conversion of the
> binary-to-text. Anyone who can tell me how to do that?

The purpose of drawnow (TERM, FILE, MONO, DEBUG_FILE) is for debugging.
So that it is natural that output data is in the raw style.
The reason of sendig binary data to gnuplot is for speed up of plot especially for 3D plots.

You can specify TERM directly by drawnow command.

drawnow ("pngcairo", "test.png", false, "gnuplotstream.plt")

like

octave:15> drawnow ("pngcairo", "test.png", false, "gnuplotstream.plt")
octave:16> system('type gnuplotstream.plt | gnuplot')

This gives beautiful anti-aliased plot as a file 'test.png' using the pngciro terminal performance.

If you want text format data, you can get it
octave:21> edit 'gnuplotstream.plt'

In the notepad++,
Please modify
 :
set terminal pngcairo enhanced  size 863,1117
set output 'test.png';
set multiplot;
 :

to
 :
#set terminal pngcairo enhanced  size 863,1117 #commented
#set output 'test.png'; #commented
#set multiplot; #commented
set table 'xydata.txt' #<-add this line
 :

Then save modified file by Notepad++ and then
octave:22> system('type gnuplotstream.plt | gnuplot')

You can get text file (xydata.txt)

# Curve 0 of 1, 101 points
# x y type
0 0  i
0.0628319 0.0627905  i
0.125664 0.125333  i
0.188496 0.187381  i
0.251327 0.24869  i
0.314159 0.309017  i
0.376991 0.368125  i
0.439823 0.425779  i
 :
 :

You can confirm it for example using the below,
 system("gnuplot --persist -e \"plot 'xydata.txt' w l\"")

Hope the above helps for you

Regards

Tatsuro

>
> 2010/4/2 Tatsuro MATSUOKA <[hidden email]>:
> > Hello
> >
> > --- Tatsuro MATSUOKAwrote:
> >
> >>
> >> I have reported the above issue of gnuplot for windows to SourceForge bug tracker of the
> gnuplot
> >> team.
> >
> > The url is
> > http://sourceforge.net/tracker/?func=detail&atid=102055&aid=2981027&group_id=2055
> >
> >
> > --------------------------------------
> > Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
> > http://pr.mail.yahoo.co.jp/ie8/
> >
>


--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gnuplot scripts as output?

dieter.jurzitza@t-online.de
In reply to this post by Tribo Laboy
Dear Tribo,
basically nobody stops you from exporting the data into ascii files:

octave:1> for i=1:1000
> A(i)=sin(2.0*pi*(i-1)/999.0);
> endfor
octave:2> outfile = fopen("dummy.dat", "w");
octave:3> for i=1:1000
> fprintf(outfile, "%d %f\n", i, A(i));
> endfor
octave:4> fclose (outfile)
ans = 0

would write a sinusoid into a file. Given you start gnuplot in the directory you wrote "dummy.dat"
to, you could say:

plot "dummy.dat" using 1:2 w l lw 2 title "A sine"

well, and the title says what you'll get. And by this you could circumvent the problems with binary
data for plotting in gnuplot, simply export them into ascii-files, adopt the names in the gnuplot-
plt file accordingly and you ought to be done.

Hope this helps,
take care



Dieter

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

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <┬░┬░__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------


_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Loading...