geocat.viz.util.add_height_from_pressure_axis#
- geocat.viz.util.add_height_from_pressure_axis(ax, heights=None, pressure_units='hPa', ticklabelsize=12, label='Height (km)', labelpad=10, axislabelsize=16)#
Utility function that adds a right-hand Height axis to the plot, derived from the left-hand Pressure axis. Replicates the height-axis functionality in NCL’s `gsn_csm_pres_hgt`method for drawing a pressure/height plot.
- Parameters:
ax (
matplotlib.axes._subplots.AxesSubplot
,cartopy.mpl.geoaxes.GeoAxesSubplot
) – Current axes to the current figureheights (
numpy.ndarray
,list
) – Optional array of desired height values in km.pressure_units (
str
) – Optional Pint-compliant unit string associated with the Pressure values. Assume to be hPa.ticklabelsize (
int
) – Optional text font size of tick labels. A default value of 12 is used if nothing is set.label (
str
) – Optional text to use for the right hand side label.labelpad (
float
) – Optional spacing in points from the axes bounding box. A default value of 10 is used if nothing is set.axislabelsize (
int
) – Optional text font size for y-axes. A default value of 16 is used if nothing is set.
- Returns:
axRHS (
matplotlib.axes._subplots.AxesSubplot
,cartopy.mpl.geoaxes.GeoAxesSubplot
) – The created right-hand axis
See also
Related
Examples
See this example notebook: add_height_from_pressure_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.