axes#

Axis helpers for plots of transformed (log- or arcsinh-scaled) values.

Functions#

add_log_ticks(ax[, transform, axis, prefix, sep])

Place ticks at powers of ten on an axis plotted in transformed units.

Module Contents#

openplaces.viz.axes.add_log_ticks(ax, transform=np.arcsinh, axis='x', prefix='', sep='', **kwargs)#

Place ticks at powers of ten on an axis plotted in transformed units.

Use after plotting data passed through a log-like transform (e.g. np.arcsinh or np.log10): ticks are positioned at transform(10**n) for every power of ten within the current axis limits and labeled with the original value via openplaces.utils.short_number() (e.g. ‘$10K’, ‘$1M’).

Parameters:
  • ax (matplotlib.axes.Axes) – Axes whose x or y values are transformed data.

  • transform (callable) – The transform that was applied to the plotted data.

  • axis (str) – ‘x’ or ‘y’.

  • prefix (str) – Prepended to each label (e.g. ‘$’).

  • sep (str) – Separator between number and unit, passed to short_number.

  • **kwargs – Further keyword arguments passed to short_number.

Return type:

matplotlib.axes.Axes