Labels

Monday, March 5, 2012

Multi-Panel Figures

Ferret distribution do not include any convenient scripts to make multi-panel figures.
In the past, I have posted two versions of a GO file to define multiple viewports in the Ferret email forum. It is surprising to learn that such usefull scripts posted in the Forum never makes way to later Ferret releases. The most recent version of my multi_view GO file is introduced in this post. This is one of the most frequently used GO files in my research work and I hope that you will find it useful.

Previous versions of multi_view GO file and details are available here and here. Its usage is pretty simple and straight forward, like :

CB --> corner box (for labeling a panel)

GO multi_view [rows],[columns],[xsize],[xstart],[xgap],[ysize],[ystart],[ygap],[view_name_prefix],[CB_xsize],[CB_ysize]

where,

rows : number of rows colunms : numbr of columns
xsize : view size along X ysize : view size along Y
xstart : xlo for lefternmost view ystart : ylo for bottommost view
xgap : spacing between view along X ygap : spacing between view along Y
prefix : prefix to view number (default is V) CB_xsize : xsize for corner box
CB_ysize : ysize for corner box

With multi_view, it is easy to :
  • define desired number of viewports with given size and position
  • place panel labels (like (A), (b) etc.) at panel corners
  • remove unwanted white space between panels
  • control spacing between figure axis and axis labels
  • define viewports with same X-size but differnt Y-size (or vice versa) 
  • make overlay plots with variables of different dimensions
  • draw line legends on a time axis plot 
Few examples are shown below :

The demo script which generated these figures and the multi_view.jnl GO file are given towards the end of this post.

This figure has too much space between panels. Tune [xgap] and [ygap] to remove extra space between panels.
Easy panel labeling within plot area.
Temperature (shading) has dimensions (X,Z) and mided layer depth (MLD,line) has dimension (X). This overlay plot is made by defining two identical viewports and  using first one for tempearture and second one for MLD. 
For publications we may have to reduce figure size often. Here is a quick fix using multi_view by reducing the spacing between axis and its labels.
Both upper and lower panels have same X-axis and hence the same size, but Y-axes are different. Such "corresponding axis" plots are very easy with muti_view.
How many panels you need in a figure? This figure is made by few lines in Ferret and was possible only with multi_view. (Currently Ferret allow only 200 viewports at a time. Remember that multi_view always define 4 corner boxes for labelling. Hence this example has 9 rows x 4 colums = 36 main viewports, 36*4 = 144 corner viewports and a total of 180 viewports.)

multi_view GO file

Copy and save this as multi_view.jnl and place it in your ferret/go directory for easy access. Otherwise you can place it in a convenient location and update the path in ferret_paths file.




multi_view demo script

Copy and save this as multi_view_demo.jnl and give a try (this one needs access to multi_view.jnl, coads_climatology.cdf and levitus_climatology.cdf).



No comments:

Post a Comment