Metadata-Version: 2.4
Name: matplotlib-matrix-legend
Version: 0.0.3
Summary: Matrix legend layout for matplotlib
Project-URL: Homepage, https://github.com/nj-vs-vh/matplotlib-matrix-legend
Project-URL: Issues, https://github.com/nj-vs-vh/matplotlib-matrix-legend/issues
Author-email: Igor Vaiman <gosha.vaiman@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Matrix legend for Matplotlib

A small extension for [Matplotlib](https://matplotlib.org/)'s Legend to create
matrix legends for plots parametrized with the cartesian product of two grids.
Consider the following toy example of evaluating different functions with
different "frequency" parameter values. Full enumeration of function+parameter
pairs gets cumbersome very quickly, but the same information can be naturally
presented in a table layout.

![comparison of regular and matrix legends](https://raw.githubusercontent.com/nj-vs-vh/matplotlib-matrix-legend/refs/heads/main/images/demo.png)

## Installation

```sh
pip install matplotlib-matrix-legend
```

## Usage

The module exports one public function, a drop-in replacement for `Axes.legend`
method. Since most of the functionality is inherited directly from the original Legend class,
the styling, layout, custom handles and other features should largely work as expected.

```python
from matrix_legend import matrix_legend

fig, ax = plt.subplots()
# your plotting here

# instead of ax.legend(...)
# see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html
# for args & kwargs
matrix_legend(ax, ...)
```
