[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pslatex terminal output--Problem identified.
From: |
John W. Eaton |
Subject: |
Re: pslatex terminal output--Problem identified. |
Date: |
Wed, 21 Sep 2005 22:24:04 -0400 |
On 21-Sep-2005, Pete Gustafson wrote:
| Thanks to all for the many suggestions. I've figured
| out the problem at least, and am now getting good
| plots.
|
| >It seems to work properly for me, using the following
| >commands in
| >Octave 2.1.69:
| >
| > x = -10:0.1:10;
| > plot (x, sin(x))
| > gset term pslatex
| > gset output "foo.tex"
| > replot
| > set term x11
| > gset output "/dev/null"
|
| The problem was when I called print() prior to
| executing the pslatex calls. The following will
| reproduce the problem.
|
| x = -10:0.1:10;
| plot (x, sin(x))
| print('foo.eps','-depsc2')
| gset term pslatex
| gset output "foo.tex"
| replot
| gset term x11
| gset output "/dev/null"
|
| If I skip the print call, the plots in pslatex are
| fine.
|
|
| >
| >What version of Octave are you using? What OS?
| >Precisely what
| >commands did you use to generate the plot? etc. etc.
|
| I'm using octave 2.1.71 with octave-forge-2005.06.13
| on up to date gentoo linux.
OK, I think this might be a bug in gnuplot. You can reproduce it with
the following commands (these are essentially the commands that Octave
is sending to gnuplot, but plotting a function instead of a data file
to simplify things a bit)):
plot sin(x) title "line 1"
set terminal push
set term postscript eps enhanced color solid
set output "foo.eps"
replot
set terminal pop
set output
replot
set term pslatex
set output "foo.tex"
replot
quit
I have not looked at the code, so I am only guessing here, but it
seems that the problem might be that gnuplot is hanging on to some
postscript terminal options even after the set terminal pop statement
is executed. If you insert something like
set term postscript landscape
just after the set terminal pop statement, the problem goes away. But
how can Octave know that it should do that? It seems it would be
better for "set term pop" to restore the state of the terminal driver
to whatever it was when "set term push" was executed.
Here is a simpler example. Compare foo.eps vs. foo.ps from the
following two scripts.
1:
plot sin(x) title "line 1"
set terminal push
set term postscript
set output "foo.ps"
replot
set terminal pop
set output
replot
set term postscript eps enhanced color solid
set output "foo.eps"
replot
quit
2:
plot sin(x) title "line 1"
set terminal push
set term postscript eps enhanced color solid
set output "foo.eps"
replot
set terminal pop
set output
replot
set term postscript
set output "foo.ps"
replot
quit
Looking at these I would expect foo.ps in both cases to be the simple
full page postscript plot. But in the second case, both plots are
small eps style plots.
I just checked the latest CVS gnuplot and it seems the behavior is the
same. Would someone like to report this problem and find out if it is
intentional behavior or a bug?
Thanks,
jwe
-------------------------------------------------------------
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
-------------------------------------------------------------