# Custom Hovermode

**URL:** <https://community.plotly.com/t/custom-hovermode/61258>\
**Category:** Dash Python\
**Created:** [February 21, 2022, 3:17pm UTC](https://community.plotly.com/t/custom-hovermode/61258 "2022-02-21T15:17:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SHRees](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/shrees/32/17543_2.png) [@SHRees](https://community.plotly.com/u/SHRees)\
**Post date:** [February 21, 2022, 3:17pm UTC](https://community.plotly.com/t/custom-hovermode/61258/1 "2022-02-21T15:17:47Z")

</div>

Hi there,

I am trying to display the percentage and also the count on this histogram hover label using [this](https://plotly.com/python/hover-text-and-formatting/) hovertemplate documentation, doesn’t seem to be working?

example label:

Percentage: 84%  
Count: 5344

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/d/a/dae80dfc9f1212dfde70d8c532e91697325c1279.png)

```python

region_mirco_census_filtered_test = region_mirco_census[region_mirco_census['UK region'] == 'South East']

Region = go.Histogram(
    x=region_mirco_census_filtered_test['Characteristic - Ethnicity'], histnorm='percent',
    opacity=0.4, name="Region", hovertemplate = region_mirco_census['Characteristic - Ethnicity'].value_counts()
)
UK_average = go.Histogram(
    x=region_mirco_census['Characteristic - Ethnicity'], histnorm='percent', marker=dict(color='rgba(0,0,0,0)', line=dict(width=2, color='red')),
    opacity=0.6, name="UK average", hovertemplate = region_mirco_census['Characteristic - Ethnicity'].value_counts()
)

data = [Region, UK_average]
layout = go.Layout(barmode='overlay')
fig1 = go.Figure(data=data, layout=layout)

fig1.show()

```

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [February 21, 2022, 5:41pm UTC](https://community.plotly.com/t/custom-hovermode/61258/2 "2022-02-21T17:41:34Z")

</div>

Hi,

Hovertemplate should be a template string with some special syntax, which allows you to combine `x` and `y` coordinates easily with the text. That said, I don’t think the pre-defined variables would contain both the percentage and count in your histogram, therefore you need to specify the two columns as `customdata`.

Here’s a recent thread about this very same topic: [Histogram plot hover data not showing all columns - #2 by jlfsjunior](https://community.plotly.com/t/histogram-plot-hover-data-not-showing-all-columns/61158/2)

Hope this helps!
