# Graphically representing constraint on TF2

**URL:** <https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974>\
**Category:** Newbie\
**Created:** [April 19, 2020, 1:23am UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974 "2020-04-19T01:23:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![seamus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://root-forum.cern.ch/u/seamus)\
**Post date:** [April 19, 2020, 1:23am UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/1 "2020-04-19T01:23:26Z")

</div>

Hi,

I have a surface color contour plot made using a TF2 object, but above a certain line of y = f(x), the x and y variables represent unphysical situations and I basically want to not show anything in these areas or in some way show that they’re excluded. I tried having the function I used in the TF2 constructor only return a value if the constraints are satisfied, but that did nothing.

The idea I had was to superimpose a TF1 object representing the constraint line as y = f(x) and then fill the area above the curve to be excluded, but I’m running into a lot of difficulty here and I have a feeling this isn’t the most intelligent way to go about this.

I hope this question isn’t too open ended for here, but I’m just looking for any help or suggestions to go about this.

Thanks

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [April 19, 2020, 9:02pm UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/2 "2020-04-19T21:02:29Z")

</div>

@couet Do you have an idea?

---

<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:** [April 20, 2020, 6:48am UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/3 "2020-04-20T06:48:36Z")

</div>

Can you provide some example I can start from ?

---

<div class="post-metadata">

**Author:** ![seamus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://root-forum.cern.ch/u/seamus)\
**Post date:** [April 20, 2020, 2:23pm UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/4 "2020-04-20T14:23:25Z")

</div>

Thanks for the response, here’s a macro for what I’m trying to do with the transparent pad. I haven’t tried shading the area above the curve yet, but I would just like to know if there’s any better method.

[cont\_test.cxx](https://root-forum.cern.ch/uploads/short-url/ppG0dlwevcOJgOt1AbGUSRS4Ag.cxx) (823 Bytes)

---

<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:** [April 20, 2020, 2:28pm UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/5 "2020-04-20T14:28:56Z")

</div>

You macro gives me this picture. What should I do

 ![Screenshot 2020-04-20 at 16.27.59](https://root-forum.cern.ch/uploads/default/original/3X/9/2/92f1748564bb27955f423fe8f63b528574040b32.png) with it ?

---

<div class="post-metadata">

**Author:** ![seamus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://root-forum.cern.ch/u/seamus)\
**Post date:** [April 20, 2020, 2:47pm UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/6 "2020-04-20T14:47:11Z")

</div>

I want to mark the area above the curve as excluded in some way. I think could define another TF1 on the transparent pad which intersects with this one off the graph area & shade between them, but in the actual application I’m running into difficulty even reproducing a plot like that shown and I’m wondering if you know a better way to do that, perhaps within the scope of the TF2 itself.

---

<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:** [April 20, 2020, 2:55pm UTC](https://root-forum.cern.ch/t/graphically-representing-constraint-on-tf2/38974/7 "2020-04-20T14:55:08Z")

</div>

For that we have [the exclusion graphs.](https://root.cern/doc/master/classTGraphPainter.html#GP02).
