diff --git a/CHANGELOG.md b/CHANGELOG.md index d99d70608e..fdc347344b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [5.7.0] - UNRELEASED + +### Added + - added `pattern_shape` options to `px.area()` [#3668](https://github.com/plotly/plotly.py/issues/3668) + +### Updated + - Updated Plotly.js to from version 2.9.0 to version 2.11.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2111----2022-03-15) for more information. Notable changes include: + - Add `fillpattern` options to `scatter` trace + - Various JS-specific improvements such as MathJax 3.0 support + ## [5.6.0] - 2022-02-09 ### Updated diff --git a/doc/python/filled-area-plots.md b/doc/python/filled-area-plots.md index 0dd7f12159..96a932b1aa 100644 --- a/doc/python/filled-area-plots.md +++ b/doc/python/filled-area-plots.md @@ -5,10 +5,10 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.2' - jupytext_version: 1.6.0 + format_version: '1.3' + jupytext_version: 1.13.7 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.7.6 + version: 3.9.7 plotly: description: How to make filled area plots in Python with Plotly. display_as: basic @@ -44,8 +44,7 @@ This example shows how to fill the area enclosed by traces. ```python import plotly.express as px df = px.data.gapminder() -fig = px.area(df, x="year", y="pop", color="continent", - line_group="country") +fig = px.area(df, x="year", y="pop", color="continent", line_group="country") fig.show() ``` @@ -62,11 +61,28 @@ snippet_url = 'https://python-docs-dash-snippets.herokuapp.com/python-docs-dash- IFrame(snippet_url + 'filled-area-plots', width='100%', height=1200) ``` +### Pattern Fills + +*New in v5.0* + +Area charts afford the use of [patterns (also known as hatching or texture)](/python/pattern-hatching-texture/) in addition to color: + +```python +import plotly.express as px +df = px.data.medals_long() + +fig = px.area(df, x="medal", y="count", color="nation", + pattern_shape="nation", pattern_shape_sequence=[".", "x", "+"]) +fig.show() +``` + + ### Filled area chart with plotly.graph_objects #### Basic Overlaid Area Chart + -```python +```python tags=[] import plotly.graph_objects as go fig = go.Figure() diff --git a/doc/python/pattern-hatching-texture.md b/doc/python/pattern-hatching-texture.md index b2059069cd..f9bc027036 100644 --- a/doc/python/pattern-hatching-texture.md +++ b/doc/python/pattern-hatching-texture.md @@ -5,10 +5,10 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.2' - jupytext_version: 1.4.2 + format_version: '1.3' + jupytext_version: 1.13.7 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.7.7 + version: 3.9.7 plotly: description: How to use patterns (also known as hatching or texture) with bar charts. @@ -36,16 +36,16 @@ jupyter: *New in v5.0* -[Bar charts](/python/bar-charts/), [histograms](/python/histograms/) and [polar bar charts](/python/wind-rose-charts/) have large markers which support not only a fill color, but also an optional **pattern** (also known as "hatching" or "texture"). This can be used for a variety of reasons: +[Bar charts](/python/bar-charts/), [histograms](/python/histograms/), [polar bar charts](/python/wind-rose-charts/) and [area charts](/python/filled-area-plots/) have large markers or areas which support not only a fill color, but also an optional **pattern** (also known as "hatching" or "texture"). This can be used for a variety of reasons: * to double-encode variables (i.e. using both color and pattern) to improve accessibility for visually-impaired end-users * to encode an additional variable beyond just using color * to make charts that are easier to print in black and white -### Patterned Bar Charts with Plotly Express +### Patterned Charts with Plotly Express -the `px.bar()`, `px.histogram()` and `px.bar_polar()` functions support the `pattern_shape` argument. In the chart below, we double-encode `nation` using color and pattern: +the `px.bar()`, `px.histogram()`, `px.bar_polar()` and `px.area()` functions support the `pattern_shape` argument. In the chart below, we double-encode `nation` using color and pattern: ```python import plotly.express as px @@ -55,6 +55,14 @@ fig = px.bar(df, x="medal", y="count", color="nation", pattern_shape="nation") fig.show() ``` +```python +import plotly.express as px +df = px.data.medals_long() + +fig = px.area(df, x="medal", y="count", color="nation", pattern_shape="nation") +fig.show() +``` + In the chart below we use `px.histogram()` instead of `px.bar()` to aggregate multiple values together, and encode one variable (sex) using both color and x-position and another (smoker) using patterns: ```python