<p align="center">
<img src="docs/_static/img/logo-wide.png" alt="ridgeplot - beautiful ridgeline plots in Python">
</p>
<h1 id="ridgeplot" align="center">
ridgeplot: beautiful ridgeline plots in Python
</h1>
<p align="center">
<!-- TODO: https://bestpractices.coreinfrastructure.org/en -->
<!-- TODO: https://www.gitpod.io/docs/getting-started -->
<a href="https://pypi.org/project/ridgeplot/"><img src="https://img.shields.io/pypi/v/ridgeplot" alt="PyPI - Latest Release"></a>
<a href="https://github.com/tpvasconcelos/ridgeplot/"><img src="https://img.shields.io/pypi/pyversions/ridgeplot" alt="PyPI - Python Versions"></a>
<a href="https://pypi.org/project/ridgeplot/"><img src="https://img.shields.io/pypi/dm/ridgeplot" alt="PyPI - Downloads"></a>
<a href="https://pypi.org/project/ridgeplot/"><img src="https://img.shields.io/pypi/status/ridgeplot.svg" alt="PyPI - Package Status"></a>
<a href="https://github.com/tpvasconcelos/ridgeplot/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/ridgeplot" alt="PyPI - License"></a>
<br>
<a href="https://github.com/tpvasconcelos/ridgeplot/actions/workflows/ci.yaml/"><img src="https://github.com/tpvasconcelos/ridgeplot/actions/workflows/ci.yaml/badge.svg" alt="GitHub CI"></a>
<a href="https://ridgeplot.readthedocs.io/en/latest/"><img src="https://readthedocs.org/projects/ridgeplot/badge/?version=latest&style=flat" alt="Docs"></a>
<a href="https://codecov.io/gh/tpvasconcelos/ridgeplot"><img src="https://codecov.io/gh/tpvasconcelos/ridgeplot/branch/main/graph/badge.svg" alt="codecov"></a>
<a href="https://www.codefactor.io/repository/github/tpvasconcelos/ridgeplot"><img src="https://www.codefactor.io/repository/github/tpvasconcelos/ridgeplot/badge" alt="CodeFactor"></a>
<a href="https://app.codacy.com/gh/tpvasconcelos/ridgeplot/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/e21652ac49874b6f94ed3c9b7ac77021" alt="Codacy code quality Badge"></a>
</p>
______________________________________________________________________
`ridgeplot` is a Python package that provides a simple interface for plotting beautiful and interactive [ridgeline plots](https://www.data-to-viz.com/graph/ridgeline.html) within the extensive [Plotly](https://plotly.com/python/) ecosystem.
## Installation
`ridgeplot` can be installed and updated from [PyPi](https://pypi.org/project/ridgeplot/) using [pip](https://pip.pypa.io/en/stable/quickstart/):
```shell
pip install -U ridgeplot
```
For more information, see the [installation guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/installation.html).
## Getting started
Take a look at the [getting started guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html), which provides a quick introduction to the `ridgeplot` library.
The full official documentation can be found at: https://ridgeplot.readthedocs.io/en/stable/
### Basic example
This basic example gets you started with a simple call to the `ridgeplot()` function.
```python
import numpy as np
from ridgeplot import ridgeplot
my_samples = [np.random.normal(n / 1.2, size=600) for n in range(8, 0, -1)]
fig = ridgeplot(samples=my_samples)
fig.update_layout(height=450, width=800)
fig.show()
```
![ridgeline plot example using the ridgeplot Python library](docs/_static/charts/basic.webp)
### Flexible configuration
In this example, we will be replicating the first ridgeline plot example in this [_from Data to Viz_ post](https://www.data-to-viz.com/graph/ridgeline.html), which uses the _"Perception of Probability Words"_ dataset.
```python
import numpy as np
from ridgeplot import ridgeplot
from ridgeplot.datasets import load_probly
# Load the probly dataset
df = load_probly()
# Let's grab the subset of columns used in the example
column_names = [
"Almost Certainly",
"Very Good Chance",
"We Believe",
"Likely",
"About Even",
"Little Chance",
"Chances Are Slight",
"Almost No Chance",
]
df = df[column_names]
# Not only does 'ridgeplot(...)' come configured with sensible defaults
# but is also fully configurable to your own style and preference!
fig = ridgeplot(
samples=df.to_numpy().T,
bandwidth=4,
kde_points=np.linspace(-12.5, 112.5, 500),
colorscale="viridis",
colormode="row-index",
coloralpha=0.65,
labels=column_names,
linewidth=2,
spacing=5 / 9,
)
# And you can still update and extend the final
# Plotly Figure using standard Plotly methods
fig.update_layout(
height=760,
width=900,
font_size=16,
plot_bgcolor="white",
xaxis_tickvals=[-12.5, 0, 12.5, 25, 37.5, 50, 62.5, 75, 87.5, 100, 112.5],
xaxis_ticktext=["", "0", "", "25", "", "50", "", "75", "", "100", ""],
xaxis_gridcolor="rgba(0, 0, 0, 0.1)",
yaxis_gridcolor="rgba(0, 0, 0, 0.1)",
yaxis_title="Assigned Probability (%)",
showlegend=False,
)
# Show us the work!
fig.show()
```
![ridgeline plot of the probly dataset using the ridgeplot Python library](docs/_static/charts/probly.webp)
### More examples
For more examples, take a look at the [getting started guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html). For instance, this example demonstrates how you can also draw [multiple traces](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html#more-traces) per row in your ridgeline plot:
```python
import numpy as np
from ridgeplot import ridgeplot
from ridgeplot.datasets import load_lincoln_weather
# Load test data
df = load_lincoln_weather()
# Transform the data into a 3D (ragged) array format of
# daily min and max temperature samples per month
months = df.index.month_name().unique()
samples = [
[
df[df.index.month_name() == month]["Min Temperature [F]"],
df[df.index.month_name() == month]["Max Temperature [F]"],
]
for month in months
]
# And finish by styling it up to your liking!
fig = ridgeplot(
samples=samples,
labels=months,
coloralpha=0.98,
bandwidth=4,
kde_points=np.linspace(-25, 110, 400),
spacing=0.33,
linewidth=2,
)
fig.update_layout(
title="Minimum and maximum daily temperatures in Lincoln, NE (2016)",
height=650,
width=950,
font_size=14,
plot_bgcolor="rgb(245, 245, 245)",
xaxis_gridcolor="white",
yaxis_gridcolor="white",
xaxis_gridwidth=2,
yaxis_title="Month",
xaxis_title="Temperature [F]",
showlegend=False,
)
fig.show()
```
![ridgeline plot of the Lincoln Weather dataset using the ridgeplot Python library](docs/_static/charts/lincoln_weather.webp)
Raw data
{
"_id": null,
"home_page": "https://github.com/tpvasconcelos/ridgeplot",
"name": "ridgeplot",
"maintainer": "",
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": "",
"keywords": "ridgeline,ridgeplot,joyplot,ggridges,ridges,ridge,plot,plotting,distplot,plotly",
"author": "Tomas Pereira de Vasconcelos",
"author_email": "tomasvasconcelos1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b0/39/41c960378570a7fe76b341419dce7488f3b189c17c13960008f872a5d28d/ridgeplot-0.1.24.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img src=\"docs/_static/img/logo-wide.png\" alt=\"ridgeplot - beautiful ridgeline plots in Python\">\n</p>\n\n<h1 id=\"ridgeplot\" align=\"center\">\n ridgeplot: beautiful ridgeline plots in Python\n</h1>\n\n<p align=\"center\">\n <!-- TODO: https://bestpractices.coreinfrastructure.org/en -->\n <!-- TODO: https://www.gitpod.io/docs/getting-started -->\n <a href=\"https://pypi.org/project/ridgeplot/\"><img src=\"https://img.shields.io/pypi/v/ridgeplot\" alt=\"PyPI - Latest Release\"></a>\n <a href=\"https://github.com/tpvasconcelos/ridgeplot/\"><img src=\"https://img.shields.io/pypi/pyversions/ridgeplot\" alt=\"PyPI - Python Versions\"></a>\n <a href=\"https://pypi.org/project/ridgeplot/\"><img src=\"https://img.shields.io/pypi/dm/ridgeplot\" alt=\"PyPI - Downloads\"></a>\n <a href=\"https://pypi.org/project/ridgeplot/\"><img src=\"https://img.shields.io/pypi/status/ridgeplot.svg\" alt=\"PyPI - Package Status\"></a>\n <a href=\"https://github.com/tpvasconcelos/ridgeplot/blob/main/LICENSE\"><img src=\"https://img.shields.io/pypi/l/ridgeplot\" alt=\"PyPI - License\"></a>\n <br>\n <a href=\"https://github.com/tpvasconcelos/ridgeplot/actions/workflows/ci.yaml/\"><img src=\"https://github.com/tpvasconcelos/ridgeplot/actions/workflows/ci.yaml/badge.svg\" alt=\"GitHub CI\"></a>\n <a href=\"https://ridgeplot.readthedocs.io/en/latest/\"><img src=\"https://readthedocs.org/projects/ridgeplot/badge/?version=latest&style=flat\" alt=\"Docs\"></a>\n <a href=\"https://codecov.io/gh/tpvasconcelos/ridgeplot\"><img src=\"https://codecov.io/gh/tpvasconcelos/ridgeplot/branch/main/graph/badge.svg\" alt=\"codecov\"></a>\n <a href=\"https://www.codefactor.io/repository/github/tpvasconcelos/ridgeplot\"><img src=\"https://www.codefactor.io/repository/github/tpvasconcelos/ridgeplot/badge\" alt=\"CodeFactor\"></a>\n <a href=\"https://app.codacy.com/gh/tpvasconcelos/ridgeplot/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade\"><img src=\"https://app.codacy.com/project/badge/Grade/e21652ac49874b6f94ed3c9b7ac77021\" alt=\"Codacy code quality Badge\"></a>\n</p>\n______________________________________________________________________\n\n`ridgeplot` is a Python package that provides a simple interface for plotting beautiful and interactive [ridgeline plots](https://www.data-to-viz.com/graph/ridgeline.html) within the extensive [Plotly](https://plotly.com/python/) ecosystem.\n\n## Installation\n\n`ridgeplot` can be installed and updated from [PyPi](https://pypi.org/project/ridgeplot/) using [pip](https://pip.pypa.io/en/stable/quickstart/):\n\n```shell\npip install -U ridgeplot\n```\n\nFor more information, see the [installation guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/installation.html).\n\n## Getting started\n\nTake a look at the [getting started guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html), which provides a quick introduction to the `ridgeplot` library.\n\nThe full official documentation can be found at: https://ridgeplot.readthedocs.io/en/stable/\n\n### Basic example\n\nThis basic example gets you started with a simple call to the `ridgeplot()` function.\n\n```python\nimport numpy as np\nfrom ridgeplot import ridgeplot\n\nmy_samples = [np.random.normal(n / 1.2, size=600) for n in range(8, 0, -1)]\nfig = ridgeplot(samples=my_samples)\nfig.update_layout(height=450, width=800)\nfig.show()\n```\n\n![ridgeline plot example using the ridgeplot Python library](docs/_static/charts/basic.webp)\n\n### Flexible configuration\n\nIn this example, we will be replicating the first ridgeline plot example in this [_from Data to Viz_ post](https://www.data-to-viz.com/graph/ridgeline.html), which uses the _\"Perception of Probability Words\"_ dataset.\n\n```python\nimport numpy as np\nfrom ridgeplot import ridgeplot\nfrom ridgeplot.datasets import load_probly\n\n# Load the probly dataset\ndf = load_probly()\n\n# Let's grab the subset of columns used in the example\ncolumn_names = [\n \"Almost Certainly\",\n \"Very Good Chance\",\n \"We Believe\",\n \"Likely\",\n \"About Even\",\n \"Little Chance\",\n \"Chances Are Slight\",\n \"Almost No Chance\",\n]\ndf = df[column_names]\n\n# Not only does 'ridgeplot(...)' come configured with sensible defaults\n# but is also fully configurable to your own style and preference!\nfig = ridgeplot(\n samples=df.to_numpy().T,\n bandwidth=4,\n kde_points=np.linspace(-12.5, 112.5, 500),\n colorscale=\"viridis\",\n colormode=\"row-index\",\n coloralpha=0.65,\n labels=column_names,\n linewidth=2,\n spacing=5 / 9,\n)\n\n# And you can still update and extend the final\n# Plotly Figure using standard Plotly methods\nfig.update_layout(\n height=760,\n width=900,\n font_size=16,\n plot_bgcolor=\"white\",\n xaxis_tickvals=[-12.5, 0, 12.5, 25, 37.5, 50, 62.5, 75, 87.5, 100, 112.5],\n xaxis_ticktext=[\"\", \"0\", \"\", \"25\", \"\", \"50\", \"\", \"75\", \"\", \"100\", \"\"],\n xaxis_gridcolor=\"rgba(0, 0, 0, 0.1)\",\n yaxis_gridcolor=\"rgba(0, 0, 0, 0.1)\",\n yaxis_title=\"Assigned Probability (%)\",\n showlegend=False,\n)\n\n# Show us the work!\nfig.show()\n```\n\n![ridgeline plot of the probly dataset using the ridgeplot Python library](docs/_static/charts/probly.webp)\n\n### More examples\n\nFor more examples, take a look at the [getting started guide](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html). For instance, this example demonstrates how you can also draw [multiple traces](https://ridgeplot.readthedocs.io/en/stable/getting_started/getting_started.html#more-traces) per row in your ridgeline plot:\n\n```python\nimport numpy as np\nfrom ridgeplot import ridgeplot\nfrom ridgeplot.datasets import load_lincoln_weather\n\n# Load test data\ndf = load_lincoln_weather()\n\n# Transform the data into a 3D (ragged) array format of\n# daily min and max temperature samples per month\nmonths = df.index.month_name().unique()\nsamples = [\n [\n df[df.index.month_name() == month][\"Min Temperature [F]\"],\n df[df.index.month_name() == month][\"Max Temperature [F]\"],\n ]\n for month in months\n]\n\n# And finish by styling it up to your liking!\nfig = ridgeplot(\n samples=samples,\n labels=months,\n coloralpha=0.98,\n bandwidth=4,\n kde_points=np.linspace(-25, 110, 400),\n spacing=0.33,\n linewidth=2,\n)\nfig.update_layout(\n title=\"Minimum and maximum daily temperatures in Lincoln, NE (2016)\",\n height=650,\n width=950,\n font_size=14,\n plot_bgcolor=\"rgb(245, 245, 245)\",\n xaxis_gridcolor=\"white\",\n yaxis_gridcolor=\"white\",\n xaxis_gridwidth=2,\n yaxis_title=\"Month\",\n xaxis_title=\"Temperature [F]\",\n showlegend=False,\n)\nfig.show()\n```\n\n![ridgeline plot of the Lincoln Weather dataset using the ridgeplot Python library](docs/_static/charts/lincoln_weather.webp)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Beautiful ridgeline plots in python",
"version": "0.1.24",
"project_urls": {
"Documentation": "https://ridgeplot.readthedocs.io/en/stable/",
"Homepage": "https://github.com/tpvasconcelos/ridgeplot",
"Source": "https://github.com/tpvasconcelos/ridgeplot",
"Tracker": "https://github.com/tpvasconcelos/ridgeplot/issues"
},
"split_keywords": [
"ridgeline",
"ridgeplot",
"joyplot",
"ggridges",
"ridges",
"ridge",
"plot",
"plotting",
"distplot",
"plotly"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e207ac7204cf94d205e1dd5e01c1657a1d6ace0b99921937f1242067f5f359f2",
"md5": "5a4451b10d868da6cf88157fdea30c74",
"sha256": "2efc7726eea6bdf13a1175da6e4c073b73aa55951e9f317313188d170155c258"
},
"downloads": -1,
"filename": "ridgeplot-0.1.24-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a4451b10d868da6cf88157fdea30c74",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 48224,
"upload_time": "2024-02-20T13:45:48",
"upload_time_iso_8601": "2024-02-20T13:45:48.298336Z",
"url": "https://files.pythonhosted.org/packages/e2/07/ac7204cf94d205e1dd5e01c1657a1d6ace0b99921937f1242067f5f359f2/ridgeplot-0.1.24-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b03941c960378570a7fe76b341419dce7488f3b189c17c13960008f872a5d28d",
"md5": "67451d7870c5bf66e0c3c5ca04a5cbef",
"sha256": "5081ba38e6d738157436f3202806c90788cd49cf238726f63fba72201ce119da"
},
"downloads": -1,
"filename": "ridgeplot-0.1.24.tar.gz",
"has_sig": false,
"md5_digest": "67451d7870c5bf66e0c3c5ca04a5cbef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 1214421,
"upload_time": "2024-02-20T13:45:50",
"upload_time_iso_8601": "2024-02-20T13:45:50.373857Z",
"url": "https://files.pythonhosted.org/packages/b0/39/41c960378570a7fe76b341419dce7488f3b189c17c13960008f872a5d28d/ridgeplot-0.1.24.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-20 13:45:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tpvasconcelos",
"github_project": "ridgeplot",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "ridgeplot"
}