# Setting the opacity of histogram line?

**URL:** <https://root-forum.cern.ch/t/setting-the-opacity-of-histogram-line/57489>\
**Category:** Newbie\
**Created:** [December 11, 2023, 7:12am UTC](https://root-forum.cern.ch/t/setting-the-opacity-of-histogram-line/57489 "2023-12-11T07:12:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [December 11, 2023, 7:12am UTC](https://root-forum.cern.ch/t/setting-the-opacity-of-histogram-line/57489/1 "2023-12-11T07:12:55Z")

</div>

Hi everyone,

I am trying to set the opacity of a TH1F histogram`h_singles` (red) line using

```auto
h_singles->SetLineColorAlpha(kRed, 0.164);

```

However, I am not seeing any visible changes in the canvas. Numerically I can see the opacity has been set but it doesn’t appear to be the case from visual inspection.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/1/d/1d6b15364014c54bcb1660dd116ad9e4ba391961.png)

Can someone please suggest what is the right way of going about this?

Thanks a ton !

Edit 1: I think when I export to pdf (not png)it works.  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/f/6/f6d9451f97fe3104be1299f3390cc565dcad751d.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 11, 2023, 9:41am UTC](https://root-forum.cern.ch/t/setting-the-opacity-of-histogram-line/57489/2 "2023-12-11T09:41:01Z")

</div>

As said [here](https://root.cern/doc/master/classTColor.html#C07):

_The transparency is available on all platforms when the flag `OpenGL.CanvasPreferGL` is set to `1` in `$ROOTSYS/etc/system.rootrc` , or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG, TeX … but not PostScript._

---

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [December 11, 2023, 9:54am UTC](https://root-forum.cern.ch/t/setting-the-opacity-of-histogram-line/57489/3 "2023-12-11T09:54:18Z")

</div>

Thanks a lot for pointing the issue.
