Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.22 KB

File metadata and controls

43 lines (31 loc) · 1.22 KB

Documentation Status pypi version

When you want to create or adjust the legend in matplotlib, things can get dirty. Legendkit may solve your headache.

Features

  • Easy title placement and alignment
  • Easy colorbar with shape
  • Layout for multiple legends and colorbar*

Installation

pip install legendkit

Quickstart

import numpy as np
import matplotlib.pyplot as plt
from legendkit import cat_legend, colorbar, vstack

fig, ax = plt.subplots()
data = np.random.rand(10, 10)
mappable = ax.pcolormesh(data, cmap="RdBu")

# Categorical legend
leg = cat_legend(ax, colors=["#e63946", "#457b9d", "#2a9d8f"],
                 labels=["Group A", "Group B", "Group C"], title="Groups")

# Colorbar placed outside axes
colorbar(mappable, ax=ax, title="Value")
plt.show()