Skip to content

DriViz📎

Dribia

CI/CD Tests Coverage Status Tests types - Mypy Ruff
Package PyPI PyPI - Downloads PyPI - Python Version GitHub

Data Visualization Library containing the Dribia Theme.


Documentation: https://dribia.github.io/driviz

Source Code: https://github.com/dribia/driviz


Key features📎

  • Consistent look: A theme for Altair and Matplotlib that provides a consistent look across projects.
  • Easy to use: Just import the theme and enable it.
  • Customizable: The theme can be customized to fit particular needs.

Installation📎

driviz is available on PyPI, so you can install it with pip:

pip install driviz

Example📎

import altair as alt
import pandas as pd

from driviz import theme

theme.enable()

source = pd.DataFrame({"values": [12, 23, 47, 6, 52, 19]})
base = alt.Chart(source).encode(
    alt.Theta("values:Q").stack(True),  # noqa: PD013
    alt.Radius("values").scale(type="sqrt", zero=True, rangeMin=20),
    color="values:N",
)
c1 = base.mark_arc(innerRadius=20, stroke="#fff")
c2 = base.mark_text(radiusOffset=10).encode(text="values:Q")
chart = c1 + c2

{ "$schema": "https://vega.github.io/schema/vega-lite/v5.20.1.json", "config": { "axis": { "domain": false, "grid": true, "gridColor": "#dfe6ea", "gridOpacity": 1, "labelColor": "#00004e", "labelFont": "Roboto", "labelFontSize": 18, "labelFontWeight": "normal", "tickColor": "#00004e", "titleColor": "#00004e", "titleFont": "Roboto", "titleFontSize": 16.2, "titleFontWeight": "normal" }, "background": "white", "circle": { "fill": "#0043af", "stroke": null }, "header": { "labelColor": "#00004e", "labelFont": "Roboto", "labelFontSize": 18, "labelFontWeight": "normal", "titleColor": "#00004e", "titleFont": "Roboto", "titleFontSize": 18, "titleFontWeight": "normal" }, "legend": { "labelColor": "#00004e", "labelFont": "Roboto", "labelFontSize": 16.2, "labelFontWeight": "normal", "titleColor": "#00004e", "titleFont": "Roboto", "titleFontSize": 18, "titleFontWeight": "normal" }, "line": { "stroke": "#0043af" }, "point": { "fill": "#73baff", "stroke": "#0043af" }, "range": { "category": [ "#00004e", "#0043af", "#3d97f2", "#73baff", "#a8c2aa", "#cbc771", "#ffcd1b", "#ff9424", "#ff6d2a", "#f33", "#a0213e", "#601445" ], "diverging": [ "#0043af", "#fff", "#f33" ], "heatmap": [ "#00004e", "#0043af", "#3d97f2", "#73baff", "#a8c2aa", "#cbc771", "#ffcd1b", "#ff9424", "#ff6d2a", "#f33" ], "ramp": [ "#00004e", "#0043af", "#3d97f2", "#73baff", "#a8c2aa", "#cbc771", "#ffcd1b", "#ff9424", "#ff6d2a", "#f33", "#a0213e", "#601445" ] }, "rect": { "fill": "#0043af" }, "title": { "anchor": "start", "color": "#00004e", "font": "Roboto", "fontSize": 27.0, "fontWeight": "normal", "offset": 15, "subtitleFont": "Roboto", "subtitleFontSize": 16.2, "subtitleFontStyle": "normal", "subtitleFontWeight": "normal" }, "view": { "continuousHeight": 400, "continuousWidth": 711 } }, "data": { "name": "data-9c366822ded4e1935da444f2425f2c26" }, "datasets": { "data-9c366822ded4e1935da444f2425f2c26": [ { "values": 12 }, { "values": 23 }, { "values": 47 }, { "values": 6 }, { "values": 52 }, { "values": 19 } ] }, "layer": [ { "encoding": { "color": { "field": "values", "type": "nominal" }, "radius": { "field": "values", "scale": { "rangeMin": 20, "type": "sqrt", "zero": true }, "type": "quantitative" }, "theta": { "field": "values", "stack": true, "type": "quantitative" } }, "mark": { "innerRadius": 20, "stroke": "#fff", "type": "arc" } }, { "encoding": { "color": { "field": "values", "type": "nominal" }, "radius": { "field": "values", "scale": { "rangeMin": 20, "type": "sqrt", "zero": true }, "type": "quantitative" }, "text": { "field": "values", "type": "quantitative" }, "theta": { "field": "values", "stack": true, "type": "quantitative" } }, "mark": { "radiusOffset": 10, "type": "text" } } ] }