From a27bd498be81d19bf71c8ec9a2b1f65d8dc01837 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Wed, 11 Dec 2019 10:27:20 -0500 Subject: [PATCH 1/2] example with reversed colorscale --- doc/python/colorscales.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/python/colorscales.md b/doc/python/colorscales.md index abf7d47197d..ddbff75700b 100644 --- a/doc/python/colorscales.md +++ b/doc/python/colorscales.md @@ -5,8 +5,8 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.1' - jupytext_version: 1.2.1 + format_version: '1.2' + jupytext_version: 1.3.0 kernelspec: display_name: Python 3 language: python @@ -62,6 +62,28 @@ fig = px.scatter(iris, x="sepal_width", y="sepal_length", fig.show() ``` +### Reversing a predefined colorscale + +You can reverse a predefined colorscale by appending `_r` to its name, for colorscales given either as a string or a `plotly` object. + +```python +import plotly.express as px +iris = px.data.iris() +fig = px.scatter(iris, x="sepal_width", y="sepal_length", + color="sepal_length", color_continuous_scale='Magma_r') + +fig.show() +``` + +```python +import plotly.express as px +data = [[1, .3, .5, .9], + [.3, .1, .4, 1], + [.2, .8, .9, .3]] +fig = px.imshow(data, color_continuous_scale=px.colors.diverging.Tealrose_r) +fig.show() +``` + ### Custom Discretized Heatmap Colorscale ```python From 6a62381d62f8d872019941c7a7390cf006a975f3 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Wed, 11 Dec 2019 10:58:16 -0500 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ab635be68..69932340fcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). have a `range_theta` keyword argument for representing only an angular section [#1969](https://github.com/plotly/plotly.py/pull/1969). - Docstrings of plotly.py are now doctested [#1921](https://github.com/plotly/plotly.py/pull/1921). + - Reversing a predefined colorscale by appending `_r` to its name [#1933](https://github.com/plotly/plotly.py/pull/1933) ## [4.3.0] - 2019-11-11