I’m trying to plot two histograms on the same canvas, but the second histogram is stacked on the first one. I’m not sure where I can add the option “nostack”, so any help is appreciated!
if not self.rootFile.GetDirectory( id ):
self.rootFile.mkdir( id )
self.rootFile.cd( id )
self.histoDict[ id ] = {}
self.histoDict[ id ][ "DVHIn" ][ "ShowAllDVHIn" ] = THStack( "nostack", "DVH Comparison" )
self.histoDict[ id ][ "DVHIn" ][ "ShowAllDVHIn" ].Add( self.histoDict[ id ][ "DVHIn" ][ "PlannedDVHIn" ] )
self.histoDict[ id ][ "DVHIn" ][ "ShowAllDVHIn" ].Add( self.histoDict[ id ][ "DVHIn" ][ "DeliveredDVHInAll" ] )
self.histoDict[ id ][ "DVHIn" ][ "ShowAllDVHIn" ].Write( "nostack" )
Instead of drawing the stack, I’m writing it into a rootfile directory, hence I used Write() instead of Draw(). Is it still possible to define a “nostack” option here?
So, it’s a deficiency of the THStack class (that you cannot “SetOption” as with another TH), isn’t it
Maybe it would be a good idea to add “THStack::SetOption”
Yes THStack does not have the SetOption() method. It is a “TH” I agree, but not like the others which are histograms. THStack is a collection of histograms… so it is a bit different.
With the current drawing option, the second histogram is plotted as a sum of the two histograms, which is not what I intended. How do I change the drawing option such that the two histograms are plotted as they are, so that I can compare them?
When you say:
SomeStack->Write(“SomeName”);
you will get your stack saved in your ROOT file with a new name “SomeName” (so it has nothing to do with a drawing option, you just “rename” your stack).
[quote=“Pepe Le Pew”]When you say:
SomeStack->Write(“SomeName”);
you will get your stack saved in your ROOT file with a new name “SomeName” (so it has nothing to do with a drawing option, you just “rename” your stack).[/quote]
Yup that is exactly what happens, which is why I’m looking for another way to specify the “nostack” option without using the Draw() command. Is there such a way?