astronomix.plotting_helpers.power_law_indicators module

astronomix.plotting_helpers.power_law_indicators module#

Draw power-law slope indicators on log-log plots.

Adds short reference lines of the form y ~ x^p (with optional vertical offsets and labels) anchored at a chosen point, to make the slope of a spectrum or convergence curve easy to read off by eye.

astronomix.plotting_helpers.power_law_indicators.add_power_law_indicators(ax, anchor, exponents, x_span=3.0, scales=None, labels=None, x_label='x', line_kwargs=None, text_kwargs=None)[source]#

Add power-law indicator lines of the form y ~ x^p to a log-log plot.

Parameters:
  • ax – The (log-log) axes to draw the indicator lines on.

  • anchor – The (x0, y0) point at which the indicators start.

  • exponents – One or more power-law exponents p to draw.

  • x_span – The multiplicative x-extent of each indicator line.

  • scales – Optional per-exponent vertical scale factors (default 1).

  • labels – Optional per-exponent label strings (default x^p).

  • x_label – The symbol used in the default labels.

  • line_kwargs – Keyword arguments forwarded to the line plot.

  • text_kwargs – Keyword arguments forwarded to the label text.