User Tools

Site Tools


other:python:matplotlib_by_jyp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
other:python:matplotlib_by_jyp [2020/04/10 12:46] – [Useful matplotlib reference pages] Improved 'X and Y axes parameters' and added grid lines jypeterother:python:matplotlib_by_jyp [2020/12/14 15:16] – [Useful matplotlib reference pages] Added a trick to plot axis labels when using cartopy jypeter
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([])''
other/python/matplotlib_by_jyp.txt · Last modified: 2023/10/26 10:39 by jypeter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki