Skip to content

Migrating to Hedgehogs 0.1.0

Use these replacements when updating a notebook or script from Hedgehogs 0.0.x to 0.1.0. The examples assume import hedgehogs as hdg and reuse the figures, axes and data from the original code.

Renamed calls and options

Previous call or option 0.1.0 equivalent
hdg.plots.apply_grid(ax, axis="y") hdg.plots.grid(ax=ax, axis="y")
hdg.plots.enable_minor_ticks(ax, x=True, y=False) hdg.plots.minor_ticks(ax=ax, axis="x")
hdg.plots.label(axes=axes, bullets="1") hdg.plots.label(ax=axes, numbering="numbers")
hdg.plots.legend(loc="upper center", domain="outside", ncol=2) hdg.plots.legend(loc="upper center", placement="outside", ncols=2)
hdg.set_style(figure_size=size, subplot=margins, auto_scale=True) hdg.set_style(figsize=size, subplot_margins=margins, scale_on_setup=True)
progress.set(loss=loss) progress.set_metrics(loss=loss)
hdg.Table(mode="dynamic") hdg.Table(mode="live")

For minor ticks, choose axis="x", "y" or "both". The helper installs and styles minor ticks on the selected linear axes. If your old call used x=False, y=False to style existing ticks without installing new locators, set their appearance through Matplotlib's ax.tick_params(which="minor", ...).

For panel numbering, use "letters" in place of "a", "alphabet" or "alpha". Use "numbers" in place of "1", "n" or "number", and keep None for verbatim labels.

For legends, spell out "inside" or "outside" and pass placement and ncols by keyword. Use hdg.plots.legend(ax=ax) to target one panel, or hdg.plots.legend(shared=True, fig=fig) to collect labels across a specific figure.

The former hdg.figures helper aliases have been removed. Use hdg.plots.grid(), hdg.plots.minor_ticks() and hdg.plots.square() for panel adjustments. Keep using hdg.figures.align() for alignment across figures.

Panel labels and colour bars

Replace annotate_panels(axes) with hdg.plots.label(ax=axes) for automatic panel labels. The default format is a), b), and so on. Supply literal labels to preserve the earlier parentheses or use your own text.

hdg.plots.label(["(a) Reference", "(b) Model"], ax=axes, numbering=None, halo=False)

To preserve a custom offset=(x, y), place the text with Matplotlib in axes coordinates.

ax.text(0.08, 0.92, "(a) Reference", transform=ax.transAxes,
        ha="left", va="top", fontweight="bold")

Move the label from style_colorbar() to fig.colorbar(..., label=...), or call colourbar.set_label() on an existing colour bar. Call hdg.set_style() before creating the figure to apply Hedgehogs defaults. Set the outline and tick appearance directly with colourbar.outline and colourbar.ax.tick_params() if your figure needs the earlier helper's styling.

colourbar = fig.colorbar(image, ax=ax, label="Temperature [K]")

See the Plot API and Figure API for the current signatures.