[ROOT] Plotting log axis over linear histogram

From: Mark Messier (messier@indiana.edu)
Date: Tue Feb 03 2004 - 20:25:51 MET


I'd like show a 2-D histogram which has been booked using a linear scale
(which corresponds to log10() of the variable I'm interested in) using a
log scale on a plot. Here's my try:

TH2F a("a", "a", 40,   -4,   -1, 40,   -4,   -1); // Contains my data
TH2F b("b", "b",  1, 1e-4, 1e-1,  1, 1e-4, 1e-1); // Used for axis
TCanvas* c1 = new TCanvas("c1","c1");
b.Draw();       // To draw the axes using log format
a.Draw("SAME"); // To draw the histogram, but redraws the frame!

This closely follows what I know works in PAW:

2d 100 'a' 40 -4 -1 40 -4 -1
opt logx
opt logy
null 1e-4 1e-1 1e-4 1e-1
opt linx
opt liny
h/pl 100 s

I've tried a few things using TAxis but haven't hit on the right

Any suggestions?

Mark Messier                                 e-mail: messier@indiana.edu
Department of Physics            http://www.physics.indiana.edu/~messier
Indiana University                                 Phone: (812) 855-0236
Bloomington, IN 47405                                Fax: (812) 855-0440

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