# Adding a label to an actor in VTK

**URL:** https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320
**Category:** Development
**Created:** [July 11, 2019, 2:27pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320 "2019-07-11T14:27:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [July 11, 2019, 2:27pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/1 "2019-07-11T14:27:12Z")

</div>

Hi,

I am creating a GUI with some VTK renderings. Say I want to render multiple cubes and I want to keep track of the order, I would add a label to each of the cubes signifying the order they were placed. Is it possible to add a label attribute to a vtkActor object so that when the cubes are rendered, the label is shown? Does anyone have a solution.

I would really appreciate any help.  
Thanks.

---

<div class="post-metadata">

### Author: ![lplavorante](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lplavorante/32/272_2.png) [@lplavorante](https://discourse.vtk.org/u/lplavorante)
#### Post date: [July 12, 2019, 11:30am UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/2 "2019-07-12T11:30:55Z")

</div>

Hi A.T.! I think you’ll need separate actors for that. You can use vtkFollower! I successfully used it to label wells in a geoscientific application.

Take a look at the following examples:

[https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/FinanceFieldData/](https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/FinanceFieldData/)  
[https://lorensen.github.io/VTKExamples/site/Cxx/Annotation/TextOrigin/](https://lorensen.github.io/VTKExamples/site/Cxx/Annotation/TextOrigin/)

Greetings

Luca

---

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [July 12, 2019, 2:21pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/3 "2019-07-12T14:21:11Z")

</div>

Thank you so much Luca! vtkFollower is perfect! Do you know how to specify the coordinates of the vtkFollower text so that it doesn’t intersect/ get obscured by the object I am trying to annotate?

Many thanks!

---

<div class="post-metadata">

### Author: ![lplavorante](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lplavorante/32/272_2.png) [@lplavorante](https://discourse.vtk.org/u/lplavorante)
#### Post date: [July 12, 2019, 4:34pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/4 "2019-07-12T16:34:36Z")

</div>

I have the same problem with the labels associated with my objects. So far I have not found a solution to that… It seems the labels generated by vtkFollower are positioned near the point you provide to the actor. In fact, the labels are a polygonal representation of the text, that is, a 3D Object. So, if another object is closer to the camera it will appear in front of the text.

---

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [July 12, 2019, 7:22pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/5 "2019-07-12T19:22:40Z")

</div>

A friend told me that vtkCaptionActor2D works well for him. I haven’t implemented it myself, but I thought I should tell you.

Thanks so much for your help Luca!

---

<div class="post-metadata">

### Author: ![lplavorante](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lplavorante/32/272_2.png) [@lplavorante](https://discourse.vtk.org/u/lplavorante)
#### Post date: [July 12, 2019, 8:47pm UTC](https://discourse.vtk.org/t/adding-a-label-to-an-actor-in-vtk/1320/6 "2019-07-12T20:47:43Z")

</div>

You are welcome.🙂
