Search code examples
plotgnuplot

aligning inset plots in gnuplot


How do I align an inset plot in multiplot so that the right and top frames of both plots coincide so that I get something like in this plot: enter image description here

I tried to read the documentation on coordinates but I do not understand that at all and thus I cannot properly set origin and size.


Solution

  • You specify the size of the inset relative to the main figure using set size, and then move its bottom left corner using set origin so that the top right corner is at (1,1). For example,

    set multiplot
    
    plot exp(-x)            # plot main figure
    
    set size 0.6, 0.5       # set size of inset
    set origin 0.4, 0.5     # move bottom left corner of inset
    plot cos(x)             # plot inset
    
    unset multiplot
    

    gives

    enter image description here

    Of course you will have to adjust tick labels and legends to avoid overlaps in the composite figure.