help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnuplot scripts as output?


From: Tatsuro MATSUOKA
Subject: Re: Gnuplot scripts as output?
Date: Fri, 2 Apr 2010 23:43:45 +0900 (JST)

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 <address@hidden>:
> > 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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]