Multiple plots

Example 19 - multiple plots

Plots are arranged over rows and columns with the first plot at the top left and the last plot is the bottom right. Here the margin at the bottom of the plot is increased with the bottom parameter to gopen to accomodate a unified colorbar. The colorbars are turned off for all plots apart from the last one.

_images/fig19.png
import cf, cfplot as cfp
f=cf.read('cfplot_data/ggap.nc')[1]

cfp.gopen(rows=2, columns=2, bottom=0.2)
cfp.gpos(1)
cfp.con(f.subspace(pressure=500), colorbar=None)
cfp.gpos(2)
cfp.mapset(proj='moll')
cfp.con(f.subspace(pressure=500), colorbar=None)
cfp.gpos(3)
cfp.mapset(proj='npstere', boundinglat=30, lon_0=180)
cfp.con(f.subspace(pressure=500), colorbar=None)
cfp.gpos(4)
cfp.mapset(proj='spstere', boundinglat=-30, lon_0=0)
cfp.con(f.subspace(pressure=500), colorbar_position=[0.1, 0.1, 0.8, 0.02], colorbar_orientation='horizontal')
cfp.gclose()

Example 19a - multiple plots - user specified plot positions

User specified plot limits are set by first specifying the user_position=True parameter to gopen and then the plot position to the gpos routines. The xmin, xmax, ymin, ymax paramenters for the plot display area are in normalised coordinates.

Cylidrical projection plots have an additional rider of having a degree in longitude and latitude being the same size so plots of this type might not fill the plot area specified as expected.

_images/fig19a.png
import cf, cfplot as cfp
f=cf.read('cfplot_data/ggap.nc')[1]

cfp.gopen(user_position=True)
cfp.gpos(xmin=0.1, xmax=0.5, ymin=0.5, ymax=0.9)
cfp.con(f.subspace(Z=500), title='500mb')

cfp.gpos(xmin=0.55, xmax=0.95, ymin=0.5, ymax=0.9)
cfp.con(f.subspace(Z=100), title='100mb')

cfp.gpos(xmin=0.3, xmax=0.7, ymin=0.05, ymax=0.45)
cfp.con(f.subspace(Z=10), title='10mb')

cfp.gclose()