Skip to content

Commit

Permalink
docs and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskruchten committed Apr 5, 2022
1 parent 7d8ced4 commit 2dedf02
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 23 additions & 7 deletions doc/python/filled-area-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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()
```

Expand All @@ -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()
```

<!-- #region tags=[] -->
### Filled area chart with plotly.graph_objects

#### Basic Overlaid Area Chart
<!-- #endregion -->

```python
```python tags=[]
import plotly.graph_objects as go

fig = go.Figure()
Expand Down
22 changes: 15 additions & 7 deletions doc/python/pattern-hatching-texture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2dedf02

Please sign in to comment.