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:matplotlib_by_jyp [2020/04/10 10:46] jypeter [Useful matplotlib reference pages] Improved 'X and Y axes parameters' and added grid lines |
other:python:matplotlib_by_jyp [2020/12/14 14:16] jypeter [Useful matplotlib reference pages] Added a trick to plot axis labels when using cartopy |
||
---|---|---|---|
Line 120: | Line 120: | ||
* Use the leftmost and rightmost values to specify the orientation of the axis (i.e the rightmost value can be smaller than the leftmost) | * Use the leftmost and rightmost values to specify the orientation of the axis (i.e the rightmost value can be smaller than the leftmost) | ||
* **Axis label**: ''my_plot.set_xlabel(x_label_string, fontsize=axis_label_fontsize)'' | * **Axis label**: ''my_plot.set_xlabel(x_label_string, fontsize=axis_label_fontsize)'' | ||
- | * Use the extra labelpad parameter to move the label closer (negative value) to the axis or farther (positive value): e.g. ''my_plot.set_xlabel('A closer label', labelpad=-20'' | + | * Use the extra labelpad parameter to move the label closer (negative value) to the axis or farther (positive value): e.g. ''my_plot.set_xlabel('A closer label', labelpad=-20'') |
+ | * <wrap hi>cartopy dirty trick</wrap>: you have to use ''my_plot.set_xticks([])'', otherwise the X axis label will not be printed | ||
+ | * [[https://stackoverflow.com/questions/35479508/cartopy-set-xlabel-set-ylabel-not-ticklabels|Trick source]] | ||
+ | * Trick needs to be used with ''cartopy 0.17.0''\\ Remember to update/remove this information in the future | ||
* Major (and minor) **tick marks location**: ''my_plot.set_xticks(x_ticks_values, minor=False)'' | * Major (and minor) **tick marks location**: ''my_plot.set_xticks(x_ticks_values, minor=False)'' | ||
* Use an empty list if you don't want tick marks: ''my_plot.set_xticks([])'' | * Use an empty list if you don't want tick marks: ''my_plot.set_xticks([])'' |