X
22168 Rate this article:
5.0

Modifying the size and position of a plot

Anonym

In IDL 8 (a.k.a. New) Graphics, you can interactively move and resize plots in a window. For example, make a test plot in red:

IDL> p = plot([0,1], 'r')

Select the plot by clicking the mouse in the interior of the plot frame. To move the plot, click the frame and drag it. To resize the plot, click and drag a manipulator on the corner or middle of the frame. Once you've moved and/or resized a plot, you can programmatically retrieve its new location and size from the POSITION property. For example, I moved and resized my plot to give:

IDL> print, p.position
      0.12656254      0.47788962      0.54761025      0.88085938

Note that these values are in normalized coordinates (x and y range over a unit interval); the first two values give the (x,y) coordinate of the lower left corner of the plot frame, while the last two values give the coordinate of the upper right corner of the plot frame. In IDL 8.2.2, we modified the POSITION property so that you can also programmatically set the size and position of a plot; e.g.:

IDL> p.position = [0.50, 0.45, 0.90, 0.90]

The result is a plot in the upper left corner of the window: A programmatically positioned plot.