Time for action – making an inset

  1. First we type the command:
    octave:96> subplot(1,1,1)
    

    which will open the main plotting window and allow you to make subplots.

  2. Now, to plot the graph of f1 with line width 5, we use:
    octave:97>plot(x,f_1, "linewidth", 5)
    
  3. Set the axis limits to ensure space for the inset:
    octave:98> set(gca, "xlim", [-6 2.5], "ylim", [-50 70])
    
  4. When we insert the smaller inset window, we specify the location of the lower-left corner of the inset and the length and height. We do so in fractions of the main plotting window (including the axis ticks). For example:
    octave:99> axes("position",[0.3 0.2 0.3 0.3])
    
  5. To plot in the inset, we simply use the basic plot function:
    octave:100> plot(x, f_2, "red", "linewidth", 5)
    

What just happened? ...

Get GNU Octave now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.