Metadata-Version: 2.4
Name: simple-viz-library
Version: 0.1.0
Summary: A small, opinionated wrapper around matplotlib: bar, line, scatter, histogram.
License: MIT License
        
        Copyright (c) 2026 Maurice Onyonyi
        
        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.
        
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: matplotlib
Dynamic: license-file

# Simple-Viz-Library

A small, opinionated Python wrapper around matplotlib for bar, line, scatter,
histogram, and 3D grid charts. It trades configurability for consistency: every
chart uses the same colorblind-validated palette, the same spacing and grid
rules, and the same rounded/shadowed mark style, so you get a polished result
without hand-tuning each plot.

## Features

- **`bar_chart`** — single or grouped bars, rounded corners, soft drop shadow
- **`bar_chart_3d`** — a 3D bar grid for two-axis matrix data (e.g. category x category -> magnitude)
- **`line_chart`** — multi-series lines with a gradient area fill under each
- **`scatter_chart`** — plain or grouped scatter (capped at 3 groups — past that, adjacent colors stop being reliably colorblind-distinguishable)
- **`histogram`** — bins shaded on a light-to-dark sequential ramp so adjacent bars stay visually distinct
- A shared style: an 8-color colorblind-validated categorical palette, consistent typography, hairline gridlines, and a legend that only appears when there's more than one series

## Installation

From PyPI,

```bash
pip install simple-viz-library
```

From TestPyPI,

```bash
pip install --index-url https://test.pypi.org/simple/ \
            --extra-index-url https://pypi.org/simple/ \
            simple-viz-library
```

(The `--extra-index-url` is needed because TestPyPI doesn't host `numpy` or `matplotlib` themselves.)

From source, in editable mode (for developing against it):

```bash
git clone <https://github.com/Morioh/Simple-Viz-Library.git>
cd Simple-Viz-Library
python -m venv .venv
source .venv/bin/activate
pip install -e .
```

## Quickstart

```python
import simple_viz_library as viz

fig, ax = viz.bar_chart(
    categories=["Widgets", "Gadgets", "Gizmos"],
    values=[120, 95, 143],
    title="Quarterly Revenue",
    ylabel="Revenue ($K)",
)
viz.save(fig, "revenue.png")
```

## Usage

### bar_chart

```python
# single series
viz.bar_chart(["A", "B", "C"], [3, 5, 2])

# grouped (one inner list per series, same length as categories)
viz.bar_chart(
    ["A", "B", "C"],
    [[3, 5, 2], [4, 2, 6]],
    series_labels=["2024", "2025"],
)
```

### bar_chart_3d

For a two-axis matrix — e.g. cancer type x gene -> % methylation — rendered as
a 3D bar grid:

```python
viz.bar_chart_3d(
    row_labels=["Colon", "Breast", "Lung"],
    col_labels=["GeneA", "GeneB", "GeneC"],
    values=[[35.2, 12.0, 48.9], [20.1, 55.3, 8.4], [40.0, 30.2, 15.7]],
    zlabel="% methylation",
)
```

Note: true 3D bars introduce perspective distortion (a bar further back can
*look* shorter than an equal-value bar up front) — reach for this only when you
specifically need a two-categorical-axis grid; a single-axis comparison is
almost always clearer as `bar_chart` or a heatmap.

### line_chart

```python
# single series
viz.line_chart([1, 2, 3, 4], [10, 14, 12, 18])

# multiple series
viz.line_chart(
    x=["Jan", "Feb", "Mar"],
    ys=[[52, 54, 58], [50, 62, 70]],
    series_labels=["San Francisco", "Austin"],
)
```

### scatter_chart

```python
# ungrouped
viz.scatter_chart(x=[1, 2, 3], y=[4, 2, 6])

# grouped (max 3 groups)
viz.scatter_chart(
    x=study_hours, y=exam_scores, groups=class_years,
    group_labels=["Freshman", "Sophomore", "Junior"],
)
```

### histogram

```python
viz.histogram(exam_scores, bins=12, title="Exam Score Distribution")
```

### Saving and displaying

Every chart function returns `(fig, ax)`.

```python
fig, ax = viz.bar_chart(["A", "B"], [1, 2])
viz.save(fig, "chart.png")   # write to disk
viz.show()                   # or display interactively
```

## Project structure

```
src/simple_viz_library/
├── __init__.py     # public API
├── _style.py        # shared palette, theming, and mark-shape helpers
├── bar.py            # bar_chart, bar_chart_3d
├── line.py           # line_chart
├── scatter.py         # scatter_chart
├── histogram.py       # histogram
└── output.py          # save, show
```

## Testing

```bash
pip install pytest
pytest test_viz.py -v
```

`demo.py` generates synthetic data and exercises every chart function end to end.

## License

MIT — see [LICENSE](LICENSE).
