Re: Superimposing two histograms with two axis'?

From: Brett Viren <>
Date: Tue, 19 Jul 2005 13:45:25 -0400

Hi Thomas,

Thomas Bretz <> writes:

> a) I don't want to scale my histogram, because later I have to access
> the correct data.
> b) in some cases it is not a histogram, but a TGraph, which neither
> has scale nor SetNormFactor

It's a bit of a journey, but it can be done. I've done it using overlapping TPads with the top one transparent and twiddling the scale of the secondary TPad and axis by hand (careful to make it match reality). The actual TGraphs are not scaled. Some care is needed to select the secondary scale such that its major tick marks line up with the grid lines. If you don't care about that detail, it will be simpler.

The code's not pretty, but you can look at the "BDTDPlotter::write()" method in this file:

for a concrete example. It generates this plot:

-Brett. Received on Tue Jul 19 2005 - 19:45:40 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET