user2989841
user2989841

Reputation:

How to keep previous plots and windows in Gnuplot?

I have some problems of using gnuplot. I just begin with it.

(1)What is the command for keeping the previous plot when I plot new data? Do I have to plot the old data and the new data at the same time?

(2)What is the command for open a new window while keep the old ones? Do I have to set the window's id by using, e.g., set terminal wxt 3 , before each plot?

Can anyone give me some help or some good references?

Upvotes: 1

Views: 14423

Answers (2)

sweber
sweber

Reputation: 2976

You already wrote the answers of your questions.

1.: You can use the replot command:

plot sin(x)
replot cos(x)

but this just expands to

plot sin(x), cos(x)

So, it replots all data and does not just add the cos(x).

2.: Yes, you can also switch between the windows to update the plots. But note that settings like ranges and labels are not stored per window / plot, but globally. If they are different for different plots, you have to change them every time.

You may also have a look at "set multiplot" to put several plots on one window / picture. But it is not so nice for interactive plotting, as you will notice. Also, output terminals supporting multiple pages like pdfcairo will add a new page for each plot.

Upvotes: 0

Christoph
Christoph

Reputation: 48390

Usually, to plot several data set you would use

plot 'data1.dat', 'data2.dat'

You could also use replot to add one of the data sets later

plot 'data1.dat'
...
replot 'data2.dat'

To open a new window, you must use the window's id like with set terminal wxt 2. The old windows stay open, but you cannot interact with them anymore (zooming, scrolling etc.). See also the discussion to the quesiton Two interactive windows in Gnuplot with wxt terminal.

Upvotes: 1

Related Questions