I’d like to overlay a graph on another graph with second Y axis
drawn on the right side using “Y+” option of TGraph::Draw().
To use the “Y+” option, the range of the x-axis of the second graph
must be same as the first one, or the display messes up.
But it seems to be impossible to expand the x-range of one graph
to adjust it to that of the other graph.
Is there any way to superimpose two graphs with seprate Y axises and a
common x axis in case like the attached example?
g2->GetXaxis()->SetLabelSize(0) hides the labels of the second x axis, but tick marks still remain.
Even though you hide the tick marks too, I suspect that the second x axis is only “hidden” and the second graph has not been correctly overlayed – that is, the second graph is not plotted using the first x axis.
[quote]TMultigraph properly superimposes two graphs, but unfortunately drawing option cannot be specified separately.
[/quote]
Yes, it can in teh Add function