O'Reilly logo

GNU Octave by Jesper Schmidt Hansen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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? ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required