geocat.viz.util.add_major_minor_ticks

geocat.viz.util.add_major_minor_ticks#

geocat.viz.util.add_major_minor_ticks(ax, x_minor_per_major=3, y_minor_per_major=3, basex=10, basey=10, labelsize='small', linthreshx=2, linthreshy=2)#

Utility function to make plots look like NCL plots by adding minor and major tick lines.

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

  • x_minor_per_major (int) – Number of minor ticks between adjacent major ticks on x-axis

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

  • basex (int) – If the xaxis scale is logarithmic, this is the base for the logarithm. Default is base 10.

  • basey (int) – If the yaxis scale is logarithmic, this is the base for the logarithm. Default is base 10.

  • labelsize (str, int) – Optional text size passed to tick_params. A default value of “small” is used if nothing is set.

  • linthreshx (int) – An argument passed to SymmetricalLogLocator if the xaxis scale is symlog. Defines the range (-x, x), within which the plot is linear. This avoids having the plot go to infinity around zero. Defaults to 2.

  • linthreshy (int) – An argument passed to SymmetricalLogLocator if the yaxis scale is symlog. Defines the range (-x, x), within which the plot is linear. This avoids having the plot go to infinity around zero. Defaults to 2.

Examples

See this example notebook: add_major_minor_ticks.

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.