Not sure if this is at all possible, but anyway. If we add to a TLegend using the “f” option, this will show as a box inheriting the TAttFill properties of the said object. So let’s say I have 2 objects with similar TAttFill properties, and so I would like to show them in the TLegend only as one entry (let’s say, with option “f”, the upper half showing the TAttFill of the first object and the lower half with the second, or the box is halvened diagonally…) with a single text (say, 1/2 sigma band).
How can I achieve this? I’m thinking of making the TLegend less crowded by slashing a few entries in this way.
TAttFill values of the two object are different ?
I understand that you have two different
TAttFill and you want them to have the same text attached to both ? there is now to slip diagonally the TAttFill square.
If you have a small reproducer we can see what can be done.
Yes, the TAttFill values are different for the two, and I’d like to put them under the same TLegend entry.
I don’t have a reproducer unfortunately, I was asking how can I do it. To show visually, if we take for example this plot, I would like to merge the ± 1 and 2 sigma entries into one; so I will have in their place an entry shown as a rectangle that is half green half yellow, and with e. g. ± 1/2 sigma.
TLegend does not provide such functionality. It is assume that if you have different attribute values they must have different meanings and therefore the text attached to them should be different. Do do what you are looking for you will need to draw yourself the legend box will two colors (with
TBox) and draw the legend text next to it (with
Ouch. Ok fair enough, the class was designed in that way.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.