Skip to content

Commit be88921

Browse files
author
mahdis-z
committed
coloraxis
1 parent 5f6327b commit be88921

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

python/colorscales.md

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

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

288309
```python

0 commit comments

Comments
 (0)