Skip to content

Commit 136f1d4

Browse files
authored
Merge pull request #208 from plotly/shared_coloraxis_py
coloraxis
2 parents dfa1200 + 7aa95ae commit 136f1d4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

python/colorscales.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,26 @@ fig.add_trace(go.Heatmap(
283283
fig.show()
284284
```
285285

286+
### Share Color Axis
287+
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).
288+
289+
```python
290+
import plotly.graph_objects as go
291+
from plotly.subplots import make_subplots
292+
293+
fig = make_subplots(1,2)
294+
295+
fig.add_trace(
296+
go.Heatmap(x = [1, 2, 3, 4], z = [[1, 2, 3, 4], [4, -3, -1, 1]], coloraxis = "coloraxis"), 1,1)
297+
298+
fig.add_trace(
299+
go.Heatmap(x = [3, 4, 5, 6], z = [[10, 2, 1, 0], [4, 3, 5, 6]], coloraxis = "coloraxis"),1,2)
300+
fig.update_layout(coloraxis = {'colorscale':'viridis'})
301+
302+
fig.show()
303+
```
304+
305+
286306
### Logarithmic Colorscale
287307

288308
```python

0 commit comments

Comments
 (0)