# TGraph2D Palette : Fix a value to a color

**URL:** <https://root-forum.cern.ch/t/tgraph2d-palette-fix-a-value-to-a-color/28668>\
**Category:** ROOT\
**Created:** [April 13, 2018, 12:35am UTC](https://root-forum.cern.ch/t/tgraph2d-palette-fix-a-value-to-a-color/28668 "2018-04-13T00:35:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 13, 2018, 4:09am UTC](https://root-forum.cern.ch/t/tgraph2d-palette-fix-a-value-to-a-color/28668/2 "2018-04-13T04:09:12Z")

</div>

I guess you should be able to enforce the same “z-range” for all your 2D graphs. For each of them call:

```auto
SomeTGraph2D->SetMinimum(MyMinimum);
SomeTGraph2D->SetMaximum(MyMaximum);

```

> [@Same color palette range for several TH3 drawn with glcolz](https://root-forum.cern.ch/t/same-color-palette-range-for-several-th3-drawn-with-glcolz/18625/5):
>
> I once applied a “brutal fix” to such a problem. I modified all relevant histograms destroying two bins: MyHisto-\>SetBinContent(1, 1, MyMinimum); MyHisto-\>SetBinContent(MyHisto-\>GetNbinsX(), MyHisto-\>GetNbinsY(), MyMaximum);

---

_[View the full topic](https://root-forum.cern.ch/t/tgraph2d-palette-fix-a-value-to-a-color/28668)._
