Unwanted postscript & pdf plots

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Unwanted postscript & pdf plots

Neil.Francis
Hello,

I'm using Octave 2.1.53, the fink binary version for OS X.

I ssh to the machine that has Octave installed, so have only a
text-based terminal emulator interface to it.

When I want to create figures I would like Octave to write the figures
to files.  I use code like:

gset terminal dumb
gset output "/dev/null"

semilogx (x, y, "r")
hold on
semilogx (x, z, "g")
hold off

gset terminal postscript
gset output "output.ps"
replot
closeplot


But when I open up the resulting postscript files I find two identical
figures (the figures are correct, with both y and z plotted against x).
I expected to see only one figure in the postscript file, and this is
what I get if I ask Octave to plot to a png file.

Am I doing something wrong?  I get the same result if I use terminal
type pdf.  I've heard that gnuplot postscript and Octave interact in
unexpected ways, and that is why it is best to change terminal type to
postscript and then replot only when the figure is finished - but that
doesn't seem to help here.

Thanks,
Neil



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Unwanted postscript & pdf plots

Shai Ayal
I'm not sure it will work, but maybe you should try to add another

gset terminal dumb
gset output "/dev/null"

just after the replot

Shai

[hidden email] wrote:

> Hello,
>
> I'm using Octave 2.1.53, the fink binary version for OS X.
>
> I ssh to the machine that has Octave installed, so have only a
> text-based terminal emulator interface to it.
>
> When I want to create figures I would like Octave to write the figures
> to files.  I use code like:
>
> gset terminal dumb
> gset output "/dev/null"
>
> semilogx (x, y, "r")
> hold on
> semilogx (x, z, "g")
> hold off
>
> gset terminal postscript
> gset output "output.ps"
> replot
> closeplot
>
>
> But when I open up the resulting postscript files I find two identical
> figures (the figures are correct, with both y and z plotted against x).
> I expected to see only one figure in the postscript file, and this is
> what I get if I ask Octave to plot to a png file.
>
> Am I doing something wrong?  I get the same result if I use terminal
> type pdf.  I've heard that gnuplot postscript and Octave interact in
> unexpected ways, and that is why it is best to change terminal type to
> postscript and then replot only when the figure is finished - but that
> doesn't seem to help here.
>
> Thanks,
> Neil
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>

--
Shai Ayal, Ph.D.
Head of Research
BioControl Medical BCM
3 Geron St.
Yehud 56100
ISRAEL
Tel:  + 972 3 6322 126 ext 223
Fax:  + 972 3 6322 125
email: [hidden email]



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Unwanted postscript & pdf plots

Dmitri A. Sergatskov
I suspect that this is the infamous problem of
automatic_replot defaulting to 1 in octave-2.1.53
Set
automatic_replot=0
at the beginning of your script.

Sincerely,

Dmitri.

Shai Ayal wrote:

> I'm not sure it will work, but maybe you should try to add another
>
> gset terminal dumb
> gset output "/dev/null"
>
> just after the replot
>
> Shai
>
> [hidden email] wrote:
>
>> Hello,
>>
>> I'm using Octave 2.1.53, the fink binary version for OS X.
>>
>> I ssh to the machine that has Octave installed, so have only a
>> text-based terminal emulator interface to it.
>>
>> When I want to create figures I would like Octave to write the figures
>> to files.  I use code like:
>>
>> gset terminal dumb
>> gset output "/dev/null"
>>
>> semilogx (x, y, "r")
>> hold on
>> semilogx (x, z, "g")
>> hold off
>>
>> gset terminal postscript
>> gset output "output.ps"
>> replot
>> closeplot
>>
>>
>> But when I open up the resulting postscript files I find two identical
>> figures (the figures are correct, with both y and z plotted against x).
>> I expected to see only one figure in the postscript file, and this is
>> what I get if I ask Octave to plot to a png file.
>>
>> Am I doing something wrong?  I get the same result if I use terminal
>> type pdf.  I've heard that gnuplot postscript and Octave interact in
>> unexpected ways, and that is why it is best to change terminal type to
>> postscript and then replot only when the figure is finished - but that
>> doesn't seem to help here.
>>
>> Thanks,
>> Neil
>>
>>
>>
>> -------------------------------------------------------------
>> Octave is freely available under the terms of the GNU GPL.
>>
>> Octave's home on the web:  http://www.octave.org
>> How to fund new projects:  http://www.octave.org/funding.html
>> Subscription information:  http://www.octave.org/archive.html
>> -------------------------------------------------------------
>>
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

RE: Unwanted postscript & pdf plots

Neil.Francis
In reply to this post by Neil.Francis
Hello,

Setting automatic_replot = 0 fixed the problem.

When I added an extra

gset terminal dumb
gset output "/dev/null"

after each replot I found I was getting "postscript" files containing
ascii plots, preceding the postscript!

Now the behaviour makes sense to me!

Thanks Dimitri and Shai,
Neil

-----Original Message-----
From: Dmitri A. Sergatskov [mailto:[hidden email]]
Sent: Thursday, 12 January 2006 4:31 PM
To: Shai Ayal
Cc: Francis, Neil (Minerals, Waterford); [hidden email]
Subject: Re: Unwanted postscript & pdf plots


I suspect that this is the infamous problem of
automatic_replot defaulting to 1 in octave-2.1.53
Set
automatic_replot=0
at the beginning of your script.

Sincerely,

Dmitri.

Shai Ayal wrote:

> I'm not sure it will work, but maybe you should try to add another
>
> gset terminal dumb
> gset output "/dev/null"
>
> just after the replot
>
> Shai
>
> [hidden email] wrote:
>
>> Hello,
>>
>> I'm using Octave 2.1.53, the fink binary version for OS X.
>>
>> I ssh to the machine that has Octave installed, so have only a
>> text-based terminal emulator interface to it.
>>
>> When I want to create figures I would like Octave to write the
>> figures to files.  I use code like:
>>
>> gset terminal dumb
>> gset output "/dev/null"
>>
>> semilogx (x, y, "r")
>> hold on
>> semilogx (x, z, "g")
>> hold off
>>
>> gset terminal postscript
>> gset output "output.ps"
>> replot
>> closeplot
>>
>>
>> But when I open up the resulting postscript files I find two
>> identical figures (the figures are correct, with both y and z plotted

>> against x). I expected to see only one figure in the postscript file,

>> and this is what I get if I ask Octave to plot to a png file.
>>
>> Am I doing something wrong?  I get the same result if I use terminal
>> type pdf.  I've heard that gnuplot postscript and Octave interact in
>> unexpected ways, and that is why it is best to change terminal type
>> to postscript and then replot only when the figure is finished - but
>> that doesn't seem to help here.
>>
>> Thanks,
>> Neil
>>
>>
>>
>> -------------------------------------------------------------
>> Octave is freely available under the terms of the GNU GPL.
>>
>> Octave's home on the web:  http://www.octave.org
>> How to fund new projects:  http://www.octave.org/funding.html
>> Subscription information:  http://www.octave.org/archive.html
>> -------------------------------------------------------------
>>
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Continuous colour pm3d

Neil.Francis
In reply to this post by Neil.Francis
Hello again,

Another Octave/Gnuplot newbie question...

I'm trying get a Matlab-like image function working with gnuplot and I am use the fink binary for OS X (2.1.53 and gnuplot 3.8).  I want to display matrices as images where each element is a "density" which I would like colour coded.  I am able to do this with aquaterm (looks great!), svg, pdf and ps, but when I try to use a terminal like png or jpeg I get

"Error: terminal 'png' does not support continuous colours".

I am creating thousands of image files which I want to turn into Quicktime movies with Quicktime Pro.  Quicktime Pro can use pdf, but the pdf files that are created look awful, for some reason.  Quicktime can't use svg or ps, but would be happy with png or jpeg.

I am wondering if there is a setting I've missed that will let me use pm3d with file types like png or jpeg?  I suspect gset palette may have an option I need, but haven't yet discovered.

The code I am using is similar to:

gset hidden3d;
gset data style lines;
gset surface;
gset nocontour;
gset noparametric;
gset nologscale;

gset pm3d map;
gset palette color;
gset size ratio 2;
gset noxtics;
gset noytics;
gset nokey;
gset cbrange [0.15:0.45];
gsplot (rot90(im, 1));

(it is based on code that was posted to this list about a year ago)

Thanks again,
Neil



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Continuous colour pm3d

Stéfan van der Walt
Hi Francis

Try the 'imshow', 'imsave' and other routines in the image toolbox in
octave-forge.

Regards
Stéfan

On Mon, Jan 16, 2006 at 01:21:36PM +0800, [hidden email] wrote:
> Hello again,
>
> Another Octave/Gnuplot newbie question...
>
> I'm trying get a Matlab-like image function working with gnuplot and I am use the fink binary for OS X (2.1.53 and gnuplot 3.8).  I want to display matrices as images where each element is a "density" which I would like colour coded.  I am able to do this with aquaterm (looks great!), svg, pdf and ps, but when I try to use a terminal like png or jpeg I get
>
> "Error: terminal 'png' does not support continuous colours".



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Continuous colour pm3d

Fredrik Lingvall
In reply to this post by Neil.Francis
[hidden email] wrote:

>Hello again,
>
>Another Octave/Gnuplot newbie question...
>
>I'm trying get a Matlab-like image function working with gnuplot and I am use the fink binary for OS X (2.1.53 and gnuplot 3.8).  I want to display matrices as images where each element is a "density" which I would like colour coded.  I am able to do this with aquaterm (looks great!), svg, pdf and ps, but when I try to use a terminal like png or jpeg I get
>
>"Error: terminal 'png' does not support continuous colours".
>  
>
If you have octave-forge, this should work:

    print("snapshot_0000.png", "-dpng")

I use MEncoder and ImageMagick to generate the movie (on a x86 Gentoo
machine).

See these scripts:

* Version of image.m that uses pm3d mode:

    http://www.signal.uu.se/Toolbox/dream/image.m

* Script that generates a movie:

http://www.signal.uu.se/Toolbox/dream/examples/make_snapshot.m

* An example movie:

  http://www.signal.uu.se/Toolbox/dream/video/snapshots.avi

/Fredrik



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------