TMultiGraph - add graph with different scale

Hey there,

I’m trying to plot multiple histograms on the same canvas, but I don’t know, how I can set a different axis for a plot on a TMultiGraph. What I want to do is to adjust a point of a histogram to a given axis.

This example shows problem:

The blue marker should be adjusted to the blue axis, but it is still adjusted to the black one, I tried setting the range of the axis on the added graph, but it did not help. I also tried drawing two different graphs and adding “SAME” to the draw options but that generated a completely messed up graph.

How do I fix this?

Cheers,
Adam Hunyadi

  1. Draw two graphs on one canvas with different Y scales.
  2. transpad.C: Example of a canvas showing two histograms with different scales.
  3. twoscales.C: example of macro illustrating how to superimpose two histograms

I’m trying to implement the trick with the two TGraphs trick, but the second plot and axis will not show this way :frowning:

two_graphs_example.py (1.7 KB)

Results:

Update: adding the Range() command seems to have modified the location of the TPad, so that it is on the canvas, but the location of the data points are still noway close to where they should be :frowning: ) Also, the error bar is messed up.

Update: Got it working by manually updating the ranges of the pads to the proper values! Grr, it took a lot of time, now trying to find out what happens if I do want to change the axes.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.