gnuplotgnuplot-iostream

how to zoom a subplot in multiplot mode in gnuplot?


zooming in gnu plot is done by multi plot.

But what if we have zoom a particular subplot in multi plot?

It is like a multi plot within another multi plot.

need help!


Solution

  • Within a multiplot environment you can create plots wherever you want, their positions and sizes are set with the commands set origin and set size.

    It is up to you whether the single plots are positioned side by side or one into another like in this example.

    set terminal pngcairo
    set output "multiplot.png"
    
    set samples 1000
    set xzeroaxis
    
    set multiplot
    
    set origin 0,0
    set size 1,1
    set xrange [-15:15]
    plot cos(x) * x**2, sin(x) * x**2
    
    set nokey
    
    set origin 0.3, 0.07
    set size 0.5, 0.45
    set xrange [-2:2]
    set yrange [-4:2]
    set xtics 1
    set ytics 2
    replot
    
    set origin 0.45, 0.14
    set size 0.3, 0.2
    set xrange [-0.1:0.1]
    set yrange [-0.002:0.004]
    set ytics 0.002
    set xtics 0.1
    replot
    
    unset multiplot
    

    Note that the values for origin and size are given relative to the complete picture, not relative to the previous plot.

    nested plots