Search code examples
c++gnuplotaspect-ratio

gnuplot x11 terminal - aspect ratio does not remain constant when window is resized


I have had trouble with the aspect ratio using gnuplot on the x11 terminal. I have tried 'set size ratio -1' and 'set size square' commands. All works well until the window is re-sized. The aspect ratio of the plot is not preserved unless the window is stretched in both directions in equal proportions.

I would like to maximize the x11 window while maintaining a square aspect ratio for the plot. Is this possible?

Also, I am using gnuplot version 4.6.5

EDIT #1:

i also have to note that im calling gnuplot from a c++ script. lets say i have an ascii file containing all the gnuplot commands called plotCOMMANDS. within my c++ script, i have the following system command to call gnuplot: gnuplot -persist plotCOMMANDS

if i was plotting within the gnuplot terminal, i could use the replot command (as suggested by Christoph). but is there a way to run the replot command within the c++ script each time the window is resized?


Solution

  • I think that the window content isn't updated automatically after you maximize it, but the existing plot is only rescaled to the new window size (the windows terminal has the same problem).

    You must enter replot in the interactive terminal after you maximized the window. That works fine for both the x11 and the windows terminals. The hotkey e doesn't work for x11. BTW: In the upcoming version 5.0 this behavior is fixed and the window automatically replots when the canvas size is changed.