> ## Documentation Index
> Fetch the complete documentation index at: https://docs.haiqu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Matplotlib Style

> Apply the Haiqu matplotlib style.

### Apply the Haiqu matplotlib style

### haiqu.sdk.set\_haiqu\_mpl\_style(font\_path=None)

Apply the Haiqu matplotlib style to the current session.

When `haiqu.sdk` is imported inside a Jupyter environment this function
is called automatically. Outside of Jupyter — for example in a script or a
testing harness — call it explicitly after importing `haiqu.sdk`.

The function makes the following changes to the active matplotlib session:

* **Colour cycle** — sets the default series colours to the Haiqu brand
  palette (Morpho Blue, Orange, Red, Light Blue, Black, Neutral Grey).
* **Colormaps** — registers two named colormaps:

  * `haiqu_blue` — sequential, white → Light Blue → Morpho Blue.
  * `haiqu` — diverging, Orange → white → Morpho Blue.

  `haiqu` is set as the default image colormap (`image.cmap`).
* **Typography** — if available, registers and activates provided font as the
  monospace typeface used for tick labels, axis labels, and captions. Typically
  this should be the *Suisse Int'l Mono* font, if it is available.
  The font HAIQU\_MPL\_FONT\_PATH environment variable or the font\_path arg should
  provide the path.
* **Style** — applies the bundled `haiqu.mplstyle` sheet (minimal axes,
  no top/right spines, dashed grid, square scatter markers, high-DPI save).

- **Parameters:**
  **font\_path** (*str* *|* *None*) -- The path to the font. Defaults to `None`. If
  `font_path` is not specified, the
  `HAIQU_MPL_FONT_PATH` environment variable
  is checked. If it is not set, the
  matplotlib default font is used.
- **Return type:**
  None

#### Examples

Automatic application inside a notebook (nothing extra required):

```python theme={null}
>>> import haiqu.sdk
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 2, 3])   # rendered with Haiqu style
```

Explicit application in a script:

```python theme={null}
>>> import haiqu.sdk
>>> haiqu.sdk.set_haiqu_mpl_style()
>>> plt.plot([1, 2, 3])   # rendered with Haiqu style
```

Using the registered colormaps directly:

```python theme={null}
>>> import numpy as np
>>> plt.imshow(np.random.rand(10, 10))               # haiqu (default)
>>> plt.imshow(np.random.rand(10, 10), cmap='haiqu_blue') # diverging
```

### Restore the default matplotlib style

### haiqu.sdk.unset\_haiqu\_mpl\_style()

Restore matplotlib to its default style, undoing [`set_haiqu_mpl_style()`](../index.md#haiqu.sdk.set_haiqu_mpl_style).

Resets all rcParams to the matplotlib defaults (equivalent to calling
`matplotlib.rcdefaults()`). The two brand colormaps (`haiqu_blue` and
`haiqu`) remain available in the colormap registry and can still be
referenced by name, but they are no longer the active defaults.

Use this function when you need to produce a plot without the Haiqu style
in the same session where `haiqu.sdk` was imported.

#### Examples

Temporarily disable the Haiqu style for a single plot:

```python theme={null}
>>> import haiqu.sdk
>>> import matplotlib.pyplot as plt
>>> haiqu.sdk.unset_haiqu_mpl_style()
>>> plt.plot([1, 2, 3])  # rendered with matplotlib defaults
```

Re-apply afterwards:

```python theme={null}
>>> haiqu.sdk.set_haiqu_mpl_style()
>>> plt.plot([1, 2, 3])  # rendered with Haiqu style again
```

* **Return type:**
  None


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.