Metadata-Version: 2.4
Name: charite-plot
Version: 0.2.0
Summary: Matplotlib and Altair themes for Charité – Universitätsmedizin Berlin
Project-URL: Homepage, https://github.com/pedramezani/charite-plot
Project-URL: Documentation, https://pedramezani.github.io/charite-plot
Project-URL: Repository, https://github.com/pedramezani/charite-plot
Project-URL: Bug Tracker, https://github.com/pedramezani/charite-plot/issues
Project-URL: Changelog, https://github.com/pedramezani/charite-plot/blob/main/CHANGELOG.md
Author-email: Pedram Ramezani <me@pedramramezani.de>
License: # MIT License
        
        Copyright 2026 Pedram Ramezani
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
        ---
        
        This package is based on the original `charite` R package developed by Johannes Julius Mohn (https://github.com/johannesjuliusm/charite), which is also distributed under the MIT License.
License-File: LICENSE.md
Keywords: altair,charite,matplotlib,theme,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Matplotlib
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: cycler
Requires-Dist: matplotlib>=3.5
Provides-Extra: all
Requires-Dist: altair>=5.5; extra == 'all'
Requires-Dist: vega-datasets; extra == 'all'
Provides-Extra: altair
Requires-Dist: altair>=5.5; extra == 'altair'
Requires-Dist: vega-datasets; extra == 'altair'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
Description-Content-Type: text/markdown

# charite-plot

A Python package with a Charité-styled Matplotlib theme, [visual identity](https://marke.charite.de/d/Y3FxSwD6Tz3a) colour palettes, and an Altair theme — ported from the [`charite` R package](https://github.com/johannesjuliusm/charite).

## Installation

```bash
pip install charite-plot                   # Matplotlib only
pip install "charite-plot[altair]"         # with Altair support
```

## Examples

Visualize your data with `theme_charite()` to match the Charité corporate style.

<p align="center">
<img src="https://raw.githubusercontent.com/pedramezani/charite-plot/main/docs/assets/theme_example.png" width="80%"/>
</p>

Preview the available colour palettes.

<p align="center">
<img src="https://raw.githubusercontent.com/pedramezani/charite-plot/main/docs/assets/palette_preview.png" width="80%"/>
</p>

## Quick start

### Matplotlib

```python
import matplotlib.pyplot as plt
from charite_plot.mpl_themes import theme_charite, apply_theme

apply_theme(theme_charite())

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 7, 3])
ax.set_title("My chart")
plt.show()
```

Use as a context manager to scope the theme to a single figure:

```python
from charite_plot.mpl_themes import theme_charite, using

with using(theme_charite(palette="goldelse")):
    fig, ax = plt.subplots()
    ax.bar(["A", "B", "C"], [3, 7, 5])
```

### Altair

```python
from charite_plot.altair_themes import enable
import altair as alt

enable()

chart = alt.Chart(df).mark_bar().encode(...)
```

Customise with keyword arguments:

```python
enable(palette="berryseason", font_size=13)
```

## API overview

| Symbol | Description |
|--------|-------------|
| `mpl_themes.theme_charite()` | Returns a matplotlib rcParams dict for the Charité theme |
| `mpl_themes.apply_theme(params)` | Applies a theme dict permanently to `rcParams` |
| `mpl_themes.using(params)` | Context manager: applies theme temporarily |
| `altair_themes.theme_charite()` | Returns a Vega-Lite config dict for the Charité theme |
| `altair_themes.enable(**kwargs)` | Registers and enables the theme in Altair |
| `PALETTES` | Dict of 10 named colour palettes |
| `make_palette(name, n, reverse)` | Subsample or interpolate any palette |
| `CHARITE_COLORS` | Dict of all 27 hex colour constants |

## Fonts

The fallback chain follows the official Charité brand guidelines:

**Charité Text Office → Charit? Text Office → Calibri → DejaVu Sans → sans-serif**

`DejaVu Sans` ships with Matplotlib and is always available as the penultimate fallback; `sans-serif` lets the browser or system choose if nothing else matches (important for Altair/Vega-Lite). To override the preferred font:

```python
apply_theme(theme_charite(font="Arial"))
```

## How to cite

If you use charite-plot in your work, please cite it as:

```bibtex
@software{ramezani2026chariteplot,
  author    = {Ramezani, Pedram},
  title     = {charite-plot: Matplotlib and Altair Themes for Charité – Universitätsmedizin Berlin},
  year      = {2026},
  version   = {0.2.0},
  url       = {https://github.com/pedramezani/charite-plot},
  license   = {MIT},
}
```

## Acknowledgements

This package is based on the original [`charite` R package](https://github.com/johannesjuliusm/charite) developed by Johannes Julius Mohn.

## License

MIT © 2026 Pedram Ramezani

The original `charite` R package by Johannes Julius Mohn is likewise MIT licensed.
