From be88921646e6c0112fc277f202993d4e82d67a34 Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Tue, 19 Nov 2019 15:13:26 -0500 Subject: [PATCH 1/2] coloraxis --- python/colorscales.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/python/colorscales.md b/python/colorscales.md index 565670175..d5ddddcbd 100644 --- a/python/colorscales.md +++ b/python/colorscales.md @@ -283,6 +283,27 @@ fig.add_trace(go.Heatmap( fig.show() ``` +### Share Color Axis +This example shows how to specify the color scale and color bar per trace. To share colorscale information in multiple subplots, you can use [coloraxis](https://plot.ly/javascript/reference/#scatter-marker-line-coloraxis). +Below we show how to set a reference coloraxis to a shared coloraxis, which are set in the layout. Note that multiple color scales can be linked to the same color. + + +```python +import plotly.graph_objects as go + +fig = make_subplots(1,2) + +fig.add_trace( + go.Heatmap(x = [1, 2, 3, 4], z = [[1, 2, 3, 4], [4, -3, -1, 1]], coloraxis = "coloraxis"), 1,1) + +fig.add_trace( + go.Heatmap(x = [3, 4, 5, 6], z = [[10, 2, 1, 0], [4, 3, 5, 6]], coloraxis = "coloraxis"),1,2) +fig.update_layout(coloraxis = {'colorscale':'jet'}) + +fig.show() +``` + + ### Logarithmic Colorscale ```python From 7aa95aef605212e9e5047c57ef64435ad2d9b376 Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Wed, 20 Nov 2019 11:37:12 -0500 Subject: [PATCH 2/2] make_subplots --- python/colorscales.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/colorscales.md b/python/colorscales.md index d5ddddcbd..6047b32b9 100644 --- a/python/colorscales.md +++ b/python/colorscales.md @@ -284,12 +284,11 @@ fig.show() ``` ### Share Color Axis -This example shows how to specify the color scale and color bar per trace. To share colorscale information in multiple subplots, you can use [coloraxis](https://plot.ly/javascript/reference/#scatter-marker-line-coloraxis). -Below we show how to set a reference coloraxis to a shared coloraxis, which are set in the layout. Note that multiple color scales can be linked to the same color. - +This example shows how traces can share colorbars. To share colorscale information in multiple subplots, you can use [coloraxis](https://plot.ly/javascript/reference/#scatter-marker-line-coloraxis). ```python import plotly.graph_objects as go +from plotly.subplots import make_subplots fig = make_subplots(1,2) @@ -298,7 +297,7 @@ fig.add_trace( fig.add_trace( go.Heatmap(x = [3, 4, 5, 6], z = [[10, 2, 1, 0], [4, 3, 5, 6]], coloraxis = "coloraxis"),1,2) -fig.update_layout(coloraxis = {'colorscale':'jet'}) +fig.update_layout(coloraxis = {'colorscale':'viridis'}) fig.show() ```