Is there any way to create subplots? (like in matplotlib). For example, I would like to have a 2x2 figure and use geomap in each panel.
Overview
Community Forums
Content Tools
Is there any way to create subplots? (like in matplotlib). For example, I would like to have a 2x2 figure and use geomap in each panel.
8 Comments
Vivien MAVEL
Hi Raul,
Here is an example of code to make a figure with subplots
Note that you can can specify which figure goes in which subplot (figrow, figcol) but you there is also a default order.
You also need to define a projection. The available projections are documented here: https://scitools.org.uk/cartopy/docs/latest/crs/projections.html
Raul Valenzuela
Hi Vivien,
Thanks for your answer. I'm trying to follow your code with data from the pressure level dataset:
However, I'm getting the following error:
Vivien MAVEL
It seem to work if you do not specify figrow and figcol
I will try to understand why it fails with figrow and figcol, for the time being I hope you can do without.
Raul Valenzuela
It works! Thanks!
Vivien MAVEL
Hi Raul,
For your interest, in case you have only a single row or a single column you should only specify figcol or figrow respectively.
So in your initial code the following should work too:
Note that figcol and figrow are 0 based.
If both nrows and ncols are larger or equal to 2 you can specify both figcol and figrow.
Raul Valenzuela
Thanks Vivien.
What would be the keyword for controlling the figure size? I tried
subplot_kw={'projection': proj,'figsize':[8,6]}
incdsplot.figure
but is not working.Vivien MAVEL
This should work
Raul Valenzuela
Thanks!