Search code examples
plotgnuplotgnu

Gnuplot: multiple plots in multiple windows


I want to do multiple plots related to differents data columns of the same file but I want a new window for each plot. I don't want attached plots associated to the command set multiplot layout 1,2. The idea is represented by the following pseudocode:

>gnuplot

>plot "myfile.txt" u 1:4

>#make me plot another file without deleting the previous one i.e. open a new window on which data is plotted

>instructions I don't know

>plot "myfile.txt" u: ($3*$3) 

>#I obtain two windows

Solution

  • You don't write which terminal you are using. I understand you want to have two windows next to each other, and not two graph as file on disk. In gnuplot console check for example: help wxt. In case you want two files on disk you have to select another terminal, e.g.

    set term pngcairo
    set output 'myOutput1.png'
    plot x
    set output 'myOutput2.png'
    plot x**2
    set output
    

    So with the interactive wxt terminal the following works for me:

    Code:

    ### several terminals
    reset session
    
    set term wxt 1 size 500,400
    plot sin(x)
    
    set term wxt 2 size 500,300
    plot cos(x)
    
    set term wxt 3 size 300,200
    plot x**2
    
    ### end of code
    

    Result:

    enter image description here