This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
other:python:maps_by_jyp [2019/09/12 15:56] jypeter Started adding the megabiomes example |
other:python:maps_by_jyp [2019/09/13 09:39] jypeter |
||
---|---|---|---|
Line 16: | Line 16: | ||
* Optionally reduce the number of PFTs before plotting | * Optionally reduce the number of PFTs before plotting | ||
* Use ''matplotlib''+''cartopy'' to create the plot | * Use ''matplotlib''+''cartopy'' to create the plot | ||
- | * Create two plots with a common colorbar | + | * Create two plots with a //PlateCarree// projection and a common colorbar |
- | * Use a listed colormap (and the associated norm), and pcolormesh to plot the discrete PFT values | + | * Use an //A4 portrait// (''figsize=(8.3, 11.7)'') figure size and ''subplots_adjust'' in order to improve the page layout |
+ | * Use a //listed colormap// (and the associated //norm//), and ''pcolormesh'' to plot the discrete PFT values | ||
+ | * Use a trick to make sure that the black plot border is correctly plotted above everything (''top_plot.outline_patch.set_zorder(50)'') | ||
===== Megabiome maps ===== | ===== Megabiome maps ===== | ||
Line 29: | Line 31: | ||
* Load the NetCDF model data with ''cdms2'', and the xlsx observations' data with ''pandas'' | * Load the NetCDF model data with ''cdms2'', and the xlsx observations' data with ''pandas'' | ||
+ | * Use ''matplotlib''+''cartopy'' to create the plot | ||
+ | * Create three plots on a 2x2 layout with an //Orthographic// projection (centered on Europe) and a common colorbar. Explicitly make the 4th plot //invisible// in order to make space for plotting the colorbar (''colorbar_plot.background_patch.set_visible(False)'' and ''colorbar_plot.outline_patch.set_visible(False)'') | ||
+ | * Use a square (''figsize=(8, 8)'') figure size in order to improve the page layout | ||
+ | * Use the same color scale for both the model data (plotted with ''pcolormesh'') and the observation data (plotted with ''scatter'') | ||
+ | * Use a common //listed colormap// to plot the discrete megabiome values (with a //norm// associated with the megabiome values) and the observations (with a **different //norm//** associated with the observations) | ||
/* standard page footer */ | /* standard page footer */ |