Wednesday, May 8, 2013

Script: Set_parea; a simple way to set up multiple plots on one page in GrADS

Setting page areas can be some what frustrating and time consuming, especially when you want to plot more than 1 or 2 windows on the page.  This script provides a simple way to set your plot area to fit into a user-specified grid of plots.

It is called, by providing the script with the total number of rows and columns, as well as the specified row/column for your chosen plot.  You can access a short help page by calling without the proper variables.

Example useage: 'set_parea 3 5 2 3'

This example, will set the page area to be the center of a 3x5 grid, row 2 column 3.

Options:   -margin (-m): sets margins from the page edges and in between each plot.
                  -show (-s): clears the screen and plots/labels all page areas.

An example of the -show option is shown below:

      'set_parea 4 5 2 3 -m 0.3 -s'

Example using -show option in

One potential use for this script would be to plot model output variables at all time steps on one plot.  An example script to do this is shown below, and plots 18 time steps from the RAP model.


    'set lat 22 50'
    'set lon -125 -68'
    'set gxout shaded'
    'set mpdset hires'
    'set display color white'
    'set xlab off'
    'set ylab off'




      'set t 't

      'set_parea 'rows' 'cols' 'i' 'j' -m 0.3'
      'color 5 75 5 -kind white->dodgerblue->blue->lime->green->darkgreen->yellow->goldenrod->orange->firebrick->red->darkred->fuchsia->indigo'
      'd refcclm'
      'draw title Time: 't


Resultant Image:

I have found this script very useful, and it greatly simplifies setting different page areas in GrADS.


Download RAP Example Script


  1. Kind of sweet juicy script. But this set_parea does not work on my computer. Is it older version of Grads?

  2. What is the error that you get? Are you including at least the four required arguments? Show me how you are calling it, and I may be able to help.

  3. Hey I got it right
    But I have a question. I want to plot a color bar (one for each row) Can you help me with that.

  4. The best way to plot a color bar for each row would be to use "," which allows you to specify the x/y coordinates for your color bar. The way that I do this is by using the 'q gxinfo' command to get the plot area (using the sublin, and subwrd functions), and then calling

    'xcbar 'x1' 'x2' 'y1' 'y2

    Hope that helps!

  5. I am trying to plot 2 by 2 plots of seasonal means of 40 yrs data. But only one of them gets plotted always as I set all the four plots.

  6. Hello,I am trying to plot a map (all times step in one panel) with: wind vector, SST and Topography (using 'sdfopen')but I haven't been able to plot the topography!Can you help me?