# Add data label in hvplot

**URL:** <https://discourse.holoviz.org/t/add-data-label-in-hvplot/569>\
**Category:** hvPlot\
**Created:** [April 27, 2020, 7:37am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569 "2020-04-27T07:37:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![khannaum](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/khannaum/32/495_2.png) [@khannaum](https://discourse.holoviz.org/u/khannaum)\
**Post date:** [April 27, 2020, 7:37am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/1 "2020-04-27T07:37:00Z")

</div>

This command below output graph. i want to display count data labels on the line per day/complaint  
Also how to control font of the data lables  
Kindly guide:-

cust\_group\_by\_work\_projected.groupby([‘ddate’,  
‘complaint\_type’])[‘Count’].sum().hvplot.line(title=‘RBU’,x=‘ddate’, y=[‘Count’],by=[‘complaint\_type’],rot=70)

 ![image](https://discourse.holoviz.org/uploads/default/original/1X/1aafc39ddc7273c2c3b2117eaf8a0067fa0f5f6e.png)

---

<div class="post-metadata">

**Author:** ![philippjfr](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/philippjfr/32/7_2.png) [@philippjfr](https://discourse.holoviz.org/u/philippjfr)\
**Post date:** [April 28, 2020, 10:45am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/2 "2020-04-28T10:45:13Z")

</div>

You should be able to use the `labels` method on hvPlot, e.g.:

```auto
import holoviews as hv
agg = cust_group_by_work_projected.groupby([‘ddate’,
‘complaint_type’])[‘Count’].sum()
lines = agg.hvplot.line(title=‘RBU’, x=‘ddate’, y=[‘Count’], by=[‘complaint_type’], rot=70)
labels = agg.hvplot.labels(title=‘RBU’, x=‘ddate’, y=‘Count’, by=‘complaint_type’).opts(hv.opts.Labels(text_font='Ubuntu'))
lines * labels

```

Seems quite likely that this plot would be very busy though so you might want to aggregate further to reduce the number of labels, otherwise you can play with the xoffset/yoffset options to reduce overlap.

---

<div class="post-metadata">

**Author:** ![khannaum](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/khannaum/32/495_2.png) [@khannaum](https://discourse.holoviz.org/u/khannaum)\
**Post date:** [April 28, 2020, 10:46am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/3 "2020-04-28T10:46:58Z")

</div>

thanks it’s work. if i want to set the colors and font which options to use

---

<div class="post-metadata">

**Author:** ![philippjfr](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/philippjfr/32/7_2.png) [@philippjfr](https://discourse.holoviz.org/u/philippjfr)\
**Post date:** [April 28, 2020, 10:53am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/4 "2020-04-28T10:53:47Z")

</div>

It’s not totally obvious when using hvPlot but you can use `hv.help(hv.Labels)` to see all valid options. In this case you should add something like: `.opts(hv.opts.Labels(text_font='Ubuntu', text_color='red'))`

---

<div class="post-metadata">

**Author:** ![khannaum](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/khannaum/32/495_2.png) [@khannaum](https://discourse.holoviz.org/u/khannaum)\
**Post date:** [April 28, 2020, 11:00am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/5 "2020-04-28T11:00:39Z")

</div>

thanks it work. kindly guide kindly why .opts have sub hv.opts syntax/options to implement.

---

<div class="post-metadata">

**Author:** ![philippjfr](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/philippjfr/32/7_2.png) [@philippjfr](https://discourse.holoviz.org/u/philippjfr)\
**Post date:** [April 28, 2020, 11:22am UTC](https://discourse.holoviz.org/t/add-data-label-in-hvplot/569/6 "2020-04-28T11:22:25Z")

</div>

So HoloViews allows constructing composite objects, the `hv.opts.<Element>` syntax allows precisely targeting options to a specific element despite setting it on a composite object.
