I have a TH1F plot merged from several other TH1F plots. So far I used different colors for each area (Sub-TH1F). Now I want some styles in addition to make such plots black/white printer safe. Because some plots are in front of others I can not just use a “colored style” because then the resulting plot is a mess.
So my question is: How can I combine solid color areas with black line styles on top of it (for example lines with diff. angles)?
Thanks for your quick reply. I basically know the parameter SetFillStyle(). I tried several options but the problem I still have is that I can not combine a solid color area with black lines!
For example:
myHist.SetFillColor(kRed);
gives me a solid red area. When I afterwards apply a style, e.g.:
myHist.SetFillStyle(3309)
the solid area is gone and only the mash has the color red. Perhaps you can give me a short example of how the parameter is used so that I get a black mesh on a solid red surface (instead of a red mash on a white background, see attached figures)?
But a problem appears (at least for me) if one tries to use the histograms with THStack (The “draw” option there does not help) .
Also if one uses a TLegend, one either gets the coloured area from the first histogram (using TLegend::AddEntry() with option “F”) or the mash from the second histogram. Any ideas?
I think it would be helpful to have some new SetFillStyle() options to combine colored ares with styles on top into a single histogram. Is that possible?
When using a THStack you do not need to specify the option “draw”, it is implicit. Note that when adding an object to the stack, you can specify a drawing option.
Concerning your problem with TLegend could you send me a short script showing the problem? This should not happen if you point to 2 different objects.
Thanks for your quick answer (once again )!
What I meant is that I did not succed in using several of those plots (with a colored area and a black mash) together in a THStack. Do I have to add both histograms each (one with the colored area and the cloned one with the mash)? Perhaps you can give a short example…
What concerns the TLegend. If I start from this example:
leg = new TLegend(0.7,0.6,0.9,0.9);
leg->AddEntry(hpx,"Text","F");
leg->Draw();
But then the small box in the legend only contains the red color. If I do:
leg->AddEntry(h2,"Text","F");
instead, I only get a box with the style (mesh) within the legend. I can not refer to both histos at the same time, can I? This is what I meant by saying that this is different from the situation where both histograms are drawn into one pad. Or did I miss something?
I see the problem with TLegend. Of course my suggestion does not work because you would like the legend to refer to one object only.
I will see with Olivier, once he will be back, how to solve the general problem using one object only.
To solve this question I guess we should provide a way of setting the background color of a filled area painted with hatches. Right now hatches and patterns are transparent, the color of the fill area defines the color of the hatches.
One possible way would be to have a new fill area attribute like SetHatchesBackgroundColor().
An other possibiliy would be to define some special encoding of the FillColor attribute like 1000*hatches_background+fill_color.
This requires careful thinking because TAttFill is widely used.