Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 997aad3

Browse files
committed
Added px example
1 parent 48795aa commit 997aad3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/python/2D-Histogram.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ fig = px.density_heatmap(df, x="total_bill", y="tip", facet_row="sex", facet_col
8282
fig.show()
8383
```
8484

85+
You can add `z` as text to 2D Histogram points using `fig.update_traces(texttemplate="%{z}")`
86+
87+
```python
88+
import plotly.express as px
89+
df = px.data.tips()
90+
91+
fig = px.density_heatmap(df, x="total_bill", y="tip")
92+
fig.update_traces(texttemplate="%{z}")
93+
fig.show()
94+
```
95+
8596
### Other aggregation functions than `count`
8697

8798
By passing in a `z` value and a `histfunc`, density heatmaps can perform basic aggregation operations. Here we show average Sepal Length grouped by Petal Length and Petal Width for the Iris dataset.

0 commit comments

Comments
 (0)