Data Visualization Library containing the Dribia Theme.
Project description
DriViz
CI/CD | |
Package |
Documentation: https://dribia.github.io/driviz
Source Code: https://github.com/dribia/driviz
Installation
This project resides in the Python Package Index (PyPI), so it can easily be installed with pip:
pip install driviz
Usage
from driviz import theme
theme.enable()
Examples
import altair as alt
import numpy as np
import pandas as pd
import random
from driviz import theme
theme.enable()
variety = [f"V{i}" for i in range(10)]
site = [f"site{i:02d}" for i in range(14)]
k = 10000
df = pd.DataFrame(
data={
"yield": np.random.rand(k,),
"variety": random.choices(variety, k=k),
"site": random.choices(site, k=k),
}
)
selection = alt.selection_point(fields=["site"], bind="legend")
bars = (
alt.Chart(df)
.mark_bar()
.encode(
x=alt.X("sum(yield):Q", stack="zero"),
y=alt.Y("variety:N"),
color=alt.Color("site"),
opacity=alt.condition(
selection, alt.value(1), alt.value(0.2)
)
)
.properties(title="Example chart")
.add_params(selection)
)
text = (
alt.Chart(df)
.mark_text(dx=-15, dy=3, color="white")
.encode(
x=alt.X("sum(yield):Q", stack="zero"),
y=alt.Y("variety:N"),
detail="site:N",
text=alt.Text("sum(yield):Q", format=".1f")
)
)
chart = bars + text
chart.save(
"altair_example_barh.html"
)
Contributing
Poetry is the best way to interact with this project, to install it, follow the official Poetry installation guide.
With poetry
installed, one can install the project dependencies with:
poetry install
Then, to run the project unit tests:
make test-unit
To run the linters (ruff
and mypy
):
make lint
To apply all code formatting:
make format
License
driviz
is distributed under the terms of the
MIT license.
Check the LICENSE file for further details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file driviz-0.2.1.tar.gz
.
File metadata
- Download URL: driviz-0.2.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78793821de02b9f35e80506d12d2d7a895a46b2d1649a670b134ae3b8ba4efb1 |
|
MD5 | 34abe4c85811cd89e3c00bee152b6e25 |
|
BLAKE2b-256 | 6f59894bd98578d8cc3d5c06cf3df88b6b8b98c6277cf6c6762a4bad0c55a2f5 |
File details
Details for the file driviz-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: driviz-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 206f77722094f624fc52c645620b0ca4d933e8df8d8a297ded684f9e80212ff5 |
|
MD5 | a94af128ae87ab347c5215a0fd920090 |
|
BLAKE2b-256 | 6fc60fe172417ea9cf51112f473a2a653aa9ca5389d17380afa1ca976dba27db |