Skip to content

Commit 61fb14b

Browse files
authored
example with reversed colorscale (#1997)
* example with reversed colorscale * updated changelog
1 parent d34ab39 commit 61fb14b

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3434
have a `range_theta` keyword argument for representing only an angular
3535
section [#1969](https://github.com/plotly/plotly.py/pull/1969).
3636
- Docstrings of plotly.py are now doctested [#1921](https://github.com/plotly/plotly.py/pull/1921).
37+
- Reversing a predefined colorscale by appending `_r` to its name [#1933](https://github.com/plotly/plotly.py/pull/1933)
3738

3839
## [4.3.0] - 2019-11-11
3940

Diff for: doc/python/colorscales.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.2.1
8+
format_version: '1.2'
9+
jupytext_version: 1.3.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -62,6 +62,28 @@ fig = px.scatter(iris, x="sepal_width", y="sepal_length",
6262
fig.show()
6363
```
6464

65+
### Reversing a predefined colorscale
66+
67+
You can reverse a predefined colorscale by appending `_r` to its name, for colorscales given either as a string or a `plotly` object.
68+
69+
```python
70+
import plotly.express as px
71+
iris = px.data.iris()
72+
fig = px.scatter(iris, x="sepal_width", y="sepal_length",
73+
color="sepal_length", color_continuous_scale='Magma_r')
74+
75+
fig.show()
76+
```
77+
78+
```python
79+
import plotly.express as px
80+
data = [[1, .3, .5, .9],
81+
[.3, .1, .4, 1],
82+
[.2, .8, .9, .3]]
83+
fig = px.imshow(data, color_continuous_scale=px.colors.diverging.Tealrose_r)
84+
fig.show()
85+
```
86+
6587
### Custom Discretized Heatmap Colorscale
6688

6789
```python

0 commit comments

Comments
 (0)