RE : [ROOT] Gradient Palette when drawing 2D histograms with "col" option

From: ANCIANT E. (eric.anciant@sodern.fr)
Date: Thu Mar 25 2004 - 19:06:52 MET


Hi Olivier,

Thanks a lot for your quick response,

Your suggestion is fine for me, because it gives me two workarounds:
h.SetMinimum(-1e-5);

OR

TFrame* frame = (TFrame*)gPad->FindObject("TFrame");
frame->SetFillColor(501);
frame->SetFillStyle(1001);
gPad->Update();

Yet, I am still a little bit uncomfortable with it :

Let's take (my) concrete example : I want to display a simulated
"pixelised" image (what is detected by a camera CCD for example)
Traditionally this is displayed by no light/signal = black, lot's of light/signal= white (which I don't find absurd ...)
Thus I made the grey scale given in my example (minimum signal = black, maximum signal = white), in many cases, the simulation will be simplified
and not all pixels (=bins) will receive light/signal.
The folks I am working with, do expect no-signal to appear "black" (a pixel that has not received any signal should be black). From this point of view it makes sense that "0" = black is the extremity of "less signal" = darker ...

I understand the "scattered points" philosophy that "no event" reports nothing.
Yet, concerning colours, the question is : should "report nothing" be "draw nothing" or "draw the colour of nothing" ... shouldn't it be the user responsibility to decide the colour representation of "0's", and not the quite hidden (especially for a novice) parameterization of the histogram underlying TFrame Fill colour ?
Or course the default palette colour would be set to something "clearly empty" (like white).

Another question : what happens if the histogram minimum and maximums are set by the user : I can imagine a case with a "background" level fluctuating around 0: Drawn with "col" option, it will shown something that make sense, now, I can imagine somebody wondering ("what do I have above 0 ?"), thus setting SetMinimum(0), all of a sudden, all negative bins will appear in an unexpected colour (not related to his palette)

Now that I look more carefully at THistPainter::PaintColorLevels
Something else bothers me :
Still, when histograms minimum and maximum values are set by the user
(he wants to focus on a particular range of "signal" (along Z))
bins below the Minimum limit are NOT drawn :

         if (z < zmin) continue;

( ... I guess this was mainly implemented to deal with logZ scale effects ...)
however bins above the maximum limit are drawn with the upper gradient colour :

         if (z >= zmax) theColor = ncolors-1;

Shouldn't the behaviour be the same on the 2 limits ?
( and from my points of view, drawing with last available colour in the palette ...)



In fact, in order to keep the previous behaviour as an option, (One can imagine for example that somebody is using the "don't draw" feature to superpose histogram ... ), I am wondering if this could be some sort of option (draw/no draw "0") ("col0","col0Z"  versus "col","colz" ..)


Cheers,

Eric


-----Message d'origine-----
De : Olivier Couet [mailto:Olivier.Couet@cern.ch]
Envoyé : jeudi 25 mars 2004 17:52
À : ANCIANT E.
Cc : roottalk@pcroot.cern.ch
Objet : Re: [ROOT] Gradient Palette when drawing 2D histograms with "col" option


Hi Eric,

> 1) Biny = 30, binx = 28,29  appear black, while they should be white,
> this seems to be a bug.

 This was due to some rounding errors I fixed it. Thanks to have reported
it.

> 2) I raise again the issue of drawing or not "content = 0.0" bins with
> the "col" option. This issue has already been addressed in:
>

I agree with you that in plots like the one produced by your macro, bins
with content equal to zero should not be treated in a particular way. On
the other hand, when a bin has not been filled it must be clearly visible.
But as you said, this has a sense only with "positively filled"
histograms. So, we have decided to not draw the bins with content zero
*only* if the histogram is entirely positive. So the test in
PaintColorLevels is now:

if (z == 0 && zmin >= 0) continue;

I have run all the various examples I have and didn't find a case having
unwanted side effects. Let me know if you find a "bad case".

 Thanks for your suggestions,

 Cheers,         Olivier

--
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910     
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155


********
Ce message et eventuellement les pieces jointes sont exclusivement transmis a l'usage de leur destinataire. Leur contenu est strictement confidentiel. Si vous n etes pas le bon destinataire nous vous demandons de ne pas conserver, copier, utiliser ou divulguer cette communication. Merci de le detruire et de me notifier cette erreur.

INTERNET ne permettant pas d assurer l integrite de ce message, SODERN decline toute responsabilite au cas ou il aurait ete intercepte ou modifie.


This message and possibly attachments are transmit for the exclusive use of their address. Their content is strictly confidential. If you are not the intended recipient please do not keep, copy, use or disclose this communication to others. Also please delete it and notify the sender at once.

Because of the nature of INTERNET the sender is not in a position to ensure the integrity of this message, therefore SODERN disclaims any liability whatoever in the event of this message having been intercepted and/or altered.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET