@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation :
6
6
extension : .md
7
7
format_name : markdown
8
- format_version : ' 1.2 '
9
- jupytext_version : 1.6.0
8
+ format_version : ' 1.3 '
9
+ jupytext_version : 1.13.4
10
10
kernelspec :
11
- display_name : Python 3
11
+ display_name : Python 3 (ipykernel)
12
12
language : python
13
13
name : python3
14
14
language_info :
@@ -20,10 +20,10 @@ jupyter:
20
20
name : python
21
21
nbconvert_exporter : python
22
22
pygments_lexer : ipython3
23
- version : 3.7.6
23
+ version : 3.7.11
24
24
plotly :
25
- description : How to set, create and control continuous color scales and color bars
26
- in scatter, bar, map and heatmap figures.
25
+ description : How to set, create and control continuous color scales and color
26
+ bars in scatter, bar, map and heatmap figures.
27
27
display_as : file_settings
28
28
has_thumbnail : true
29
29
ipynb : ~notebook_demo/187
@@ -518,6 +518,42 @@ fig.add_trace(go.Heatmap(
518
518
fig.show()
519
519
```
520
520
521
+ ### Color Bar Displayed Horizontally
522
+
523
+
524
+ By default, color bars are displayed vertically. You can change a color bar to be displayed horizontally by setting ` orientation ` =` h ` .
525
+
526
+ ``` python
527
+ import plotly.graph_objects as go
528
+
529
+ import six.moves.urllib
530
+ import json
531
+
532
+ # Load heatmap data
533
+ response = six.moves.urllib.request.urlopen(
534
+ " https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json" )
535
+ dataset = json.load(response)
536
+
537
+ # Create and show figure
538
+ fig = go.Figure()
539
+
540
+ fig.add_trace(go.Heatmap(
541
+ z = dataset[" z" ],
542
+ colorbar = dict (
543
+ title = " Surface Heat" ,
544
+ titleside = " top" ,
545
+ tickmode = " array" ,
546
+ tickvals = [2 , 50 , 100 ],
547
+ ticktext = [" Cool" , " Mild" , " Hot" ],
548
+ ticks = " outside" ,
549
+ orientation = ' h'
550
+
551
+ )
552
+ ))
553
+
554
+ fig.show()
555
+ ```
556
+
521
557
### Sharing a Color Axis with Graph Objects
522
558
523
559
To share colorscale information in multiple subplots, you can use [ coloraxis] ( https://plotly.com/javascript/reference/scatter/#scatter-marker-line-coloraxis ) .
0 commit comments