# TLegend coloring does not show

**URL:** <https://root-forum.cern.ch/t/tlegend-coloring-does-not-show/56809>\
**Category:** Newbie\
**Created:** [October 22, 2023, 5:30pm UTC](https://root-forum.cern.ch/t/tlegend-coloring-does-not-show/56809 "2023-10-22T17:30:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dario\_Ferrando](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dario_ferrando/32/34844_2.png) [@Dario\_Ferrando](https://root-forum.cern.ch/u/Dario_Ferrando)\
**Post date:** [October 22, 2023, 5:30pm UTC](https://root-forum.cern.ch/t/tlegend-coloring-does-not-show/56809/1 "2023-10-22T17:30:37Z")

</div>

I’m trying to make some color lines show in a TLegend by doing this:

```auto
l.AddEntry(&vg[i], "name", "l");

```

where the vector vg[i] contains all of my TGraph. The problem is that the coloring doesn’t show into the final entry.

I’ve tried by subsituting “l” with “p”, because the graphs are of course made of colored points and not lines, but the problem is that the points are so small they barely show on the legend entry.

I can’t seem to find any options to modify the coloring of the entry image without altering the look on the referred function itself.

It would also be really good if the thing could be suitable to be iterated into a for loop (the i in vg[i] is meant to compare multiple tgraphs) but anithing that works is fine

Thanks in advance.

* * *

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [October 22, 2023, 6:48pm UTC](https://root-forum.cern.ch/t/tlegend-coloring-does-not-show/56809/2 "2023-10-22T18:48:13Z")

</div>

Hi,

probably your problem is that you painted your graphs with markers of different colors, but you never assigned the same colors to the **lines** of the respective graphs. To do that, just do

```auto
for (unsigned int i=0; i<100; ++i) // replace 100 with something meaningful
    &vg[i]->SetLineColor(&vg[i]->GetMarkerColor());

```

---

<div class="post-metadata">

**Author:** ![Dario\_Ferrando](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dario_ferrando/32/34844_2.png) [@Dario\_Ferrando](https://root-forum.cern.ch/u/Dario_Ferrando)\
**Post date:** [October 22, 2023, 7:20pm UTC](https://root-forum.cern.ch/t/tlegend-coloring-does-not-show/56809/3 "2023-10-22T19:20:31Z")

</div>

it worked, thank you so much
