You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/annotated-heatmap.md
+55-6Lines changed: 55 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
format_name: markdown
8
-
format_version: '1.1'
9
-
jupytext_version: 1.1.1
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,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.6.7
23
+
version: 3.7.11
24
24
plotly:
25
25
description: How to make Annotated Heatmaps in Python with Plotly.
26
26
display_as: scientific
@@ -34,9 +34,52 @@ jupyter:
34
34
thumbnail: thumbnail/ann_heat.jpg
35
35
---
36
36
37
-
#### Simple Annotated Heatmap
37
+
### Annotated Heatmaps with plotly.express and px.imshow
38
+
39
+
40
+
These examples use [px.imshow](/python/imshow) to create Annotated Heatmaps. px.imshow is the best way creating heatmaps with z-annotations.
41
+
42
+
43
+
#### Basic Annotated Heatmap for z-annotations
44
+
45
+
46
+
After creating a figure with `px.imshow`, you can add z-annotations with `.update_traces(texttemplate="%{z}")`.
47
+
48
+
```python
49
+
import plotly.express as px
50
+
51
+
df = px.data.medals_wide(indexed=True)
52
+
53
+
fig = px.imshow(df)
54
+
fig.update_traces(texttemplate="%{z}")
55
+
56
+
fig.show()
57
+
```
58
+
59
+
#### Custom Font
60
+
61
+
62
+
You can make changes to the font using `textfont`. Here we set the font size to 20.
38
63
39
-
This page details the use of a [figure factory](/python/figure-factories/). For more examples with Heatmaps, see [this page](/python/heatmaps/).
64
+
```python
65
+
import plotly.express as px
66
+
67
+
df = px.data.medals_wide(indexed=True)
68
+
69
+
fig = px.imshow(df)
70
+
fig.update_traces(texttemplate="%{z}")
71
+
fig.update_traces(textfont={"size":20})
72
+
73
+
fig.show()
74
+
```
75
+
76
+
### Annotated Heatmaps with [figure factory](/python/figure-factories/). For more examples with Heatmaps, see [this page](/python/heatmaps/).
77
+
78
+
79
+
The remaining examples show how to create Annotated Heatmaps with [figure factory](/python/figure-factories/). For more examples with Heatmaps, see [this page](/python/heatmaps/).
For more info on Plotly heatmaps, see: https://plotly.com/python/reference/heatmap/.<br> For more info on using colorscales with Plotly see: https://plotly.com/python/heatmap-and-contour-colorscales/ <br>For more info on `ff.create_annotated_heatmap()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_annotated_heatmap.html#plotly.figure_factory.create_annotated_heatmap)
Copy file name to clipboardExpand all lines: doc/python/colorscales.md
+2-12Lines changed: 2 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -521,7 +521,7 @@ fig.show()
521
521
### Color Bar Displayed Horizontally
522
522
523
523
524
-
By default, color bars are displayed vertically. You can change a color bar to be displayed horizontally by setting `orientation`=`h`.
524
+
By default, color bars are displayed vertically. You can change a color bar to be displayed horizontally by setting the `colorbar``orientation` attribute to `h`.
Copy file name to clipboardExpand all lines: doc/python/heatmaps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,7 @@ fig.show()
216
216
### Text on Heatmap Points
217
217
218
218
219
-
In this example we add text to heatmap points using `texttemplate`. We use the values from the `text` attribute for the text. We also adjust the font size using `textfont`.
219
+
In this example we add text to heatmap points using `texttemplate`. We use the values of the `text` attribute for the text. We also adjust the font size using `textfont`.
Copy file name to clipboardExpand all lines: doc/python/histograms.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -362,9 +362,7 @@ fig.show()
362
362
### Histogram Bar Text
363
363
364
364
365
-
You can add text to histogram bars using the `texttemplate` argument. In this example we add the x-axis values as text following the format `%{variable}`. We also adjust the size of the text using `textfont_size`.
366
-
367
-
365
+
You can add text to histogram bars using the `texttemplate` argument. In this example we add the x-axis values as text following the format `%{variable}`. We also adjust the size of the text using `textfont_size`.
0 commit comments