This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
other:python:maps_by_jyp [2019/09/13 14:02] jypeter Finished adding the megabiome example |
other:python:maps_by_jyp [2021/08/03 12:01] jypeter [JYP's map room] Added link to cartopy gallery |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== JYP's map room ====== | ====== JYP's map room ====== | ||
- | You will find below a gallery of maps made with [[https://scitools.org.uk/cartopy/|cartopy]]. | + | You will find below a gallery of maps made with [[other:python:matplotlib_by_jyp|matplotlib]] and [[https://scitools.org.uk/cartopy/|cartopy]] |
+ | |||
+ | <wrap hi>Be sure to also have at least a quick look at the examples available in the [[https://scitools.org.uk/cartopy/docs/latest/gallery/|Cartopy Gallery]]!</wrap> | ||
+ | |||
+ | You can get more python information on the [[other:python:jyp_steps|JYP's recommended steps for learning python]] page. | ||
This page is under construction and its content may change drastically. The source codes are on LSCE servers, that you can hopefully access (too bad otherwise...) | This page is under construction and its content may change drastically. The source codes are on LSCE servers, that you can hopefully access (too bad otherwise...) | ||
Line 19: | Line 23: | ||
* Use an //A4 portrait// (''figsize=(8.3, 11.7)'') figure size and ''subplots_adjust'' in order to improve the page layout | * 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 //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)'') | + | * Use a trick to make sure that the black plot border is correctly plotted above everything (''top_plot.outline_patch.set_zorder(50)''). Note: the plot border problem in ''cartopy 0.17.0'' has been [[https://github.com/SciTools/cartopy/issues/1364|fixed in a future version of cartopy]] and the //outline_patch trick// will not be required at some point |
===== Megabiome maps ===== | ===== Megabiome maps ===== | ||
Line 30: | Line 34: | ||
{{:other:python:mh_cm6_cm5_megabiome.png?direct&300 |}} | {{:other:python:mh_cm6_cm5_megabiome.png?direct&300 |}} | ||
- | * Load the NetCDF model data with ''cdms2'', and the xlsx observations' data with ''pandas'' | + | * Load the NetCDF model data with ''cdms2'', and the csv observations' data with ''pandas'' |
* Use ''matplotlib''+''cartopy'' to create the plot | * 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)'') | * 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)'') |