Tgraph

Hi rooters,

I want to make a plot which has two datasets on it. The first data set I draw using TGraphErrors with draw option “AP”, so that I get a point with error bars. The second data set I want to draw using a normal TGraph but I want a draw option that draws almost a histogram, so a flat line that goes through each point for the length of a bin size. I can’t work out how to plot this second dataset in this style.

The nearest I found was the “L” option which draws a straight line through each point, so that adjacent points have a diagonal line between them. However this is not what I want, instead I want each point in the middle of a flat line which is as long as each bin size before joining to the next flat line. Almost line a bar chart with no vertical lines.

Any suggestions? Im sure someone must have done this before.

If it should look like a histogram, I would make it a histogram (TH1D) rather than TGraph, Draw it, and then Draw(“P”) the TGraphErrors on top of it. But maybe there’s a better solution…

This would be an ideal solution if I could use non integer bins for the histogram, or at least relabel the x axis afterwards with non integer bin numbers.

What do you mean by “non integer bins”? There is a constructor to create histogram with non equidistant bins for TH1x, if that’s what you mean…