Doubt
Doubt

Reputation: 1222

gnuplot reseting terminal to default output

In gnuplot, using the commands

set term pdf
set out 'filename.pdf'
plot sin(x)

allows me to write the image to a pdf. After doing so, how do I reset the output so that plot sin(x) creates the image using the built-in gnuplot display (as it does without ever have using set out in the first place).

Right now I can only acheive this by restarting gnuplot. The reset command does not seem to help. Thanks all!

Upvotes: 7

Views: 21688

Answers (2)

mgilson
mgilson

Reputation: 309929

In addition to the other answer, you could do:

set term pop
set output   #reset standard output stream

In general, you can save the terminal settings you're currently working one using:

set term ... #what you want to save
set term push
set term ... #temporary terminal
set term pop #restore the terminal settings that you "pushed"

However, as documented in help set terminal:

The command set term push remembers the current terminal including its settings while set term pop restores it. This is equivalent to save term and load term, but without accessing the filesystem. Therefore they can be used to achieve platform independent restoring of the terminal after printing, for instance. After gnuplot's startup, the default terminal or that from startup file is pushed automatically. Therefore portable scripts can rely that set term pop restores the default terminal on a given platform unless another terminal has been pushed explicitly.

Upvotes: 9

parkydr
parkydr

Reputation: 7784

Assuming you have the X11 version of gnuplot installed. Set the terminal back to x11 and reset the output

set term x11
set out

Upvotes: 4

Related Questions