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



Saturday, March 3, 2012

About this blog : My Ferret Plot

This blog is to share some of my experiences/tips/tricks with the scientific data visualization and analysis tool Ferret. You will also see many other helpfull computer related information on oceanographic research in this blog.
 
Ferret is a free data analysis and visualization tool primarily designed for oceanographers and meteorologists by PMEL NOAA. Ferret has its own advantages and disadvantages compared to other tools popular among earth science community like Matlab, NCL, GrADS, GMT, Python etc. In the last several years of use, i like Ferret for its simplicity and the quality of its graphics. However, Ferret is extremely disappointing in terms of serious data analysis due to its "delayed mode evaluation" (ie. all expressions are evaluated only when Ferret sees an action command like "plot"). For this reason I use Matlab/Fortran for data analysis and Ferret is mainly reserved for generating graphics. However, there are situations where Ferret can be quite handy, if you know how to use it properly (a good example is finding climatology from a time series, Ferret could do that in few lines of script). I will share some of my experience/trips/tricks with Ferret through this blog.

You can find all my posts in the Ferret email forum here (search for my name "Jaison Kurian").

Here is a nice Ferret plot using enhanced shading intervals for smoother colors and data filling to remove data gaps near land boundary. Please see the script used for generating this figure below.