driviz


Namedriviz JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/dribia/driviz
SummaryData Visualization Library containing the Dribia Theme.
upload_time2024-11-06 07:45:55
maintainerDribia Code
docs_urlNone
authorDribia Code
requires_python<3.13,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            DriViz
==========================

<p align="center">
    <a href="https://dribia.github.io/driviz">
    <picture style="display: block; margin-left: auto; margin-right: auto; width: 40%;">
            <source
                media="(prefers-color-scheme: dark)"
                srcset="./docs/img/logo_dribia_blanc_cropped.png"
            >
            <source
                media="(prefers-color-scheme: light)"
                srcset="./docs/img/logo_dribia_blau_cropped.png"
            >
            <img
                alt="driviz"
                src="./docs/img/logo_dribia_blau_cropped.png"
            >
        </picture>
    </a>
</p>

|         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CI/CD   | [![Tests](https://github.com/dribia/driviz/actions/workflows/test.yml/badge.svg)](https://github.com/dribia/driviz/actions/workflows/test.yml) [![Coverage Status](https://img.shields.io/codecov/c/github/dribia/driviz)](https://codecov.io/gh/dribia/driviz) [![Tests](https://github.com/dribia/driviz/actions/workflows/lint.yml/badge.svg)](https://github.com/dribia/driviz/actions/workflows/lint.yml) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) |
| Package | [![PyPI](https://img.shields.io/pypi/v/driviz)](https://pypi.org/project/driviz/) ![PyPI - Downloads](https://img.shields.io/pypi/dm/driviz?color=blue&logo=pypi&logoColor=gold) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/driviz?logo=python&logoColor=gold) [![GitHub](https://img.shields.io/github/license/dribia/driviz?color=blue)](LICENSE)                                                                                                                                                                                                                                                                                                         |
---
**Documentation**: <a href="https://dribia.github.io/driviz" target="_blank">https://dribia.github.io/driviz</a>

**Source Code**: <a href="https://github.com/dribia/driviz" target="_blank">https://github.com/dribia/driviz</a>

---

## Installation

This project resides in the Python Package Index (PyPI), so it can easily be installed with pip:
```console
pip install driviz
```

## Usage

```python
from driviz import theme

theme.enable()
```

### Examples
```python
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](https://python-poetry.org) is the best way to interact with this project, to install it,
follow the official [Poetry installation guide](https://python-poetry.org/docs/#installation).

With `poetry` installed, one can install the project dependencies with:
```console
poetry install
```

Then, to run the project unit tests:
```console
make test-unit
```

To run the linters (`ruff` and `mypy`):
```console
make lint
```

To apply all code formatting:
```console
make format
```

## License
`driviz` is distributed under the terms of the
[MIT](https://opensource.org/license/mit) license.
Check the [LICENSE](./LICENSE) file for further details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dribia/driviz",
    "name": "driviz",
    "maintainer": "Dribia Code",
    "docs_url": null,
    "requires_python": "<3.13,>=3.10",
    "maintainer_email": "code@dribia.com",
    "keywords": null,
    "author": "Dribia Code",
    "author_email": "code@dribia.com",
    "download_url": "https://files.pythonhosted.org/packages/6f/59/894bd98578d8cc3d5c06cf3df88b6b8b98c6277cf6c6762a4bad0c55a2f5/driviz-0.2.1.tar.gz",
    "platform": null,
    "description": "DriViz\n==========================\n\n<p align=\"center\">\n    <a href=\"https://dribia.github.io/driviz\">\n    <picture style=\"display: block; margin-left: auto; margin-right: auto; width: 40%;\">\n            <source\n                media=\"(prefers-color-scheme: dark)\"\n                srcset=\"./docs/img/logo_dribia_blanc_cropped.png\"\n            >\n            <source\n                media=\"(prefers-color-scheme: light)\"\n                srcset=\"./docs/img/logo_dribia_blau_cropped.png\"\n            >\n            <img\n                alt=\"driviz\"\n                src=\"./docs/img/logo_dribia_blau_cropped.png\"\n            >\n        </picture>\n    </a>\n</p>\n\n|         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CI/CD   | [![Tests](https://github.com/dribia/driviz/actions/workflows/test.yml/badge.svg)](https://github.com/dribia/driviz/actions/workflows/test.yml) [![Coverage Status](https://img.shields.io/codecov/c/github/dribia/driviz)](https://codecov.io/gh/dribia/driviz) [![Tests](https://github.com/dribia/driviz/actions/workflows/lint.yml/badge.svg)](https://github.com/dribia/driviz/actions/workflows/lint.yml) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) |\n| Package | [![PyPI](https://img.shields.io/pypi/v/driviz)](https://pypi.org/project/driviz/) ![PyPI - Downloads](https://img.shields.io/pypi/dm/driviz?color=blue&logo=pypi&logoColor=gold) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/driviz?logo=python&logoColor=gold) [![GitHub](https://img.shields.io/github/license/dribia/driviz?color=blue)](LICENSE)                                                                                                                                                                                                                                                                                                         |\n---\n**Documentation**: <a href=\"https://dribia.github.io/driviz\" target=\"_blank\">https://dribia.github.io/driviz</a>\n\n**Source Code**: <a href=\"https://github.com/dribia/driviz\" target=\"_blank\">https://github.com/dribia/driviz</a>\n\n---\n\n## Installation\n\nThis project resides in the Python Package Index (PyPI), so it can easily be installed with pip:\n```console\npip install driviz\n```\n\n## Usage\n\n```python\nfrom driviz import theme\n\ntheme.enable()\n```\n\n### Examples\n```python\nimport altair as alt\nimport numpy as np\nimport pandas as pd\nimport random\nfrom driviz import theme\n\ntheme.enable()\n\nvariety =  [f\"V{i}\" for i in range(10)]\nsite = [f\"site{i:02d}\" for i in range(14)]\nk = 10000\ndf = pd.DataFrame(\n    data={\n        \"yield\": np.random.rand(k,),\n        \"variety\": random.choices(variety, k=k),\n        \"site\": random.choices(site, k=k),\n    }\n)\n\nselection = alt.selection_point(fields=[\"site\"], bind=\"legend\")\n\nbars = (\n    alt.Chart(df)\n    .mark_bar()\n    .encode(\n        x=alt.X(\"sum(yield):Q\", stack=\"zero\"),\n        y=alt.Y(\"variety:N\"),\n        color=alt.Color(\"site\"),\n        opacity=alt.condition(\n            selection, alt.value(1), alt.value(0.2)\n        )\n    )\n    .properties(title=\"Example chart\")\n    .add_params(selection)\n)\n\ntext = (\n    alt.Chart(df)\n    .mark_text(dx=-15, dy=3, color=\"white\")\n    .encode(\n        x=alt.X(\"sum(yield):Q\", stack=\"zero\"),\n        y=alt.Y(\"variety:N\"),\n        detail=\"site:N\",\n        text=alt.Text(\"sum(yield):Q\", format=\".1f\")\n    )\n)\n\nchart = bars + text\nchart.save(\n    \"altair_example_barh.html\"\n)\n```\n\n## Contributing\n[Poetry](https://python-poetry.org) is the best way to interact with this project, to install it,\nfollow the official [Poetry installation guide](https://python-poetry.org/docs/#installation).\n\nWith `poetry` installed, one can install the project dependencies with:\n```console\npoetry install\n```\n\nThen, to run the project unit tests:\n```console\nmake test-unit\n```\n\nTo run the linters (`ruff` and `mypy`):\n```console\nmake lint\n```\n\nTo apply all code formatting:\n```console\nmake format\n```\n\n## License\n`driviz` is distributed under the terms of the\n[MIT](https://opensource.org/license/mit) license.\nCheck the [LICENSE](./LICENSE) file for further details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Data Visualization Library containing the Dribia Theme.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/dribia/driviz",
        "Repository": "https://github.com/dribia/driviz"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fc60fe172417ea9cf51112f473a2a653aa9ca5389d17380afa1ca976dba27db",
                "md5": "a94af128ae87ab347c5215a0fd920090",
                "sha256": "206f77722094f624fc52c645620b0ca4d933e8df8d8a297ded684f9e80212ff5"
            },
            "downloads": -1,
            "filename": "driviz-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a94af128ae87ab347c5215a0fd920090",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.10",
            "size": 7355,
            "upload_time": "2024-11-06T07:45:54",
            "upload_time_iso_8601": "2024-11-06T07:45:54.998089Z",
            "url": "https://files.pythonhosted.org/packages/6f/c6/0fe172417ea9cf51112f473a2a653aa9ca5389d17380afa1ca976dba27db/driviz-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f59894bd98578d8cc3d5c06cf3df88b6b8b98c6277cf6c6762a4bad0c55a2f5",
                "md5": "34abe4c85811cd89e3c00bee152b6e25",
                "sha256": "78793821de02b9f35e80506d12d2d7a895a46b2d1649a670b134ae3b8ba4efb1"
            },
            "downloads": -1,
            "filename": "driviz-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "34abe4c85811cd89e3c00bee152b6e25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.10",
            "size": 7246,
            "upload_time": "2024-11-06T07:45:55",
            "upload_time_iso_8601": "2024-11-06T07:45:55.955464Z",
            "url": "https://files.pythonhosted.org/packages/6f/59/894bd98578d8cc3d5c06cf3df88b6b8b98c6277cf6c6762a4bad0c55a2f5/driviz-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-06 07:45:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dribia",
    "github_project": "driviz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "driviz"
}
        
Elapsed time: 0.89446s