geocat.viz.util.add_right_hand_axis

geocat.viz.util.add_right_hand_axis#

geocat.viz.util.add_right_hand_axis(ax, label=None, ylim=None, yticks=None, ticklabelsize=12, labelpad=10, axislabelsize=16, y_minor_per_major=None)#

Utility function that adds a right hand axis to the plot.

Parameters:
  • ax (matplotlib.axes._subplots.AxesSubplot, cartopy.mpl.geoaxes.GeoAxesSubplot) – Current axes to the current figure

  • label (str) – Text to use for the right hand side label.

  • ylim (tuple) – Should be given as a tuple of numeric values (left, right), where left and right are the left and right y-axis limits in data coordinates. Passing None for any of them leaves the limit unchanged. See Matplotlib documentation for further information.

  • yticks (list) – List of y-axis tick locations. See Matplotlib documentation for further information.

  • ticklabelsize (int) – Text font size of tick labels. A default value of 12 is used if nothing is set.

  • labelpad (float) – Spacing in points from the axes bounding box. A default value of 10 is used if nothing is set.

  • axislabelsize (int) – Text font size for y-axes. A default value of 16 is used if nothing is set.

  • y_minor_per_major (int) – Number of minor ticks between adjacent major ticks on y-axis.

Returns:

axRHS (matplotlib.axes._subplots.AxesSubplot, cartopy.mpl.geoaxes.GeoAxesSubplot) – The created right-hand axis

Examples

See this example notebook: add_right_hand_axis.

More in-depth plotting examples that utilize this function are in the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.