Am Montag, 10. Januar 2005 16:25 schrieb Georg Baum:
> Hello,
>
> The following command sequence
>
> plot sin(x)
> set term postscript
> set output 'fail.ps'
> replot
> set term x11
> plot sin(x)
> set term postscript
> set output 'good.ps'
> replot
>
> produces garbage in fail.ps (see attached file). This worked with gnuplot
> 3.x. This occurs both with gnuplot 4.0 as delivered with SuSE 9.2, and with
> current CVS. The problem seems to be the combination of replot and changing
> the terminal. It works if you only plot one file or if you plot to ps
> directly without x11.
> It would be nice if somebody could have a look.
Meanwhile, I had a look myself. With DEBUG defined, I get the following output
for the above script:
variable.c:92 Init loadpath from environment
command.c:365 Input line: "plot sin(x)"
term.c:467 term_init()
term.c:516 - calling term->init()
term.c:526 term_start_plot()
term.c:532 - calling term->graphics()
mouse.c:1788 (do_event) type = 8
mouse.c:1789 mx, my = 640, 450
mouse.c:1790 par1, par2 = 38, 118
mouse.c:1833 mouse do_event: window size 640 X 450, font hchar 38 vchar 118
term.c:547 term_end_plot()
term.c:553 - calling term->text()
command.c:365 Input line: "set term postscript"
term.c:753 term_reset()
command.c:365 Input line: "set output 'fail.ps'"
term.c:389 term_set_output
term.c:346 term_close_output
command.c:365 Input line: "replot"
term.c:467 term_init()
term.c:516 - calling term->init()
term.c:526 term_start_plot()
term.c:532 - calling term->graphics()
term.c:547 term_end_plot()
term.c:553 - calling term->text()
command.c:365 Input line: "set term x11"
term.c:753 term_reset()
command.c:365 Input line: "plot sin(x)"
term.c:467 term_init()
term.c:489 term_init: reopening "fail.ps" as text
term.c:389 term_set_output
term.c:346 term_close_output
term.c:516 - calling term->init()
term.c:526 term_start_plot()
term.c:532 - calling term->graphics()
mouse.c:1788 (do_event) type = 5
mouse.c:1789 mx, my = 0, 0
mouse.c:1790 par1, par2 = 0, 0
mouse.c:1788 (do_event) type = 8
mouse.c:1789 mx, my = 640, 463
mouse.c:1790 par1, par2 = 38, 115
mouse.c:1833 mouse do_event: window size 640 X 463, font hchar 38 vchar 115
term.c:547 term_end_plot()
term.c:553 - calling term->text()
command.c:365 Input line: "set term postscript"
term.c:753 term_reset()
command.c:365 Input line: "set output 'good.ps'"
term.c:389 term_set_output
term.c:346 term_close_output
command.c:365 Input line: "replot"
term.c:467 term_init()
term.c:516 - calling term->init()
term.c:526 term_start_plot()
term.c:532 - calling term->graphics()
term.c:547 term_end_plot()
term.c:553 - calling term->text()
term.c:753 term_reset()
Note 'term.c:489 term_init: reopening "fail.ps" as text'. This step destroys
the file fail.ps. The problem here is that the output file is still open when
term_init() is called and term_init() thinks that the output file needs to be
opened in text mode for X11. If I insert a line
unset output
before setting the terminal to x11 everything works, but you probably want to
fix this in gnuplot itself, since this behaviour is rather obscure and
probably not intended.
Georg
|