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/2D-Histogram.md
+24-4Lines changed: 24 additions & 4 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.2'
9
-
jupytext_version: 1.3.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.8
23
+
version: 3.7.11
24
24
plotly:
25
25
description: How to make 2D Histograms in Python with Plotly.
26
26
display_as: statistical
@@ -235,5 +235,25 @@ fig.update_layout(
235
235
fig.show()
236
236
```
237
237
238
+
### Text on 2D Histogram Points
239
+
240
+
241
+
In this example we add text to 2D-Histogram points. We use the values from the `z` attribute for the text, adding them following the format **%{variable}**.
242
+
243
+
```python
244
+
import plotly.graph_objects as go
245
+
from plotly import data
246
+
247
+
df = data.tips()
248
+
249
+
fig = go.Figure(go.Histogram2d(
250
+
x=df.total_bill,
251
+
y=df.tip,
252
+
texttemplate="%{z}"
253
+
))
254
+
255
+
fig.show()
256
+
```
257
+
238
258
#### Reference
239
259
See https://plotly.com/python/reference/histogram2d/ for more information and chart attribute options!
0 commit comments