Graphing points and forcing axis limits

I’m attempting to graph an array with 10 points. Because the scale is logarithmic on both ends, and one of the points is at 1, the scale cuts off before I get to there, and there doesn’t seem to be a way to force it to go out to 1 (on the x-axis) and make it display that first point…

…any suggestions?

Can you send a small macro showing your problem ?

Double_t rdiv[10] = {2000,400,200,100,50,40,20,10,5,1};

Double_t rms[10] =
Double_t grms[10] =
Double_t rrms[10] =

TGraph g2r(10, rdiv, rrms);
TGraph g3r(10, rdiv, grms);

TCanvas *c1 = new TCanvas();

g2r.GetYaxis()->SetTitle(“Noise RMS”);
g2r.GetXaxis()->SetTitle(“Number of sources”);



g3r.Draw(“SAMEP”); [/code][/code]

your code is truncated … please resend … (rrms line is not valid)

My apologies. That line is actually terminated right afterward:

Double_t rrms[10] =

Ok, I see what you mean. I need to investigate. I let you know.

Any thoughts?

Sorry. I have some others things to finish before. As soon they are doneI will work again on this (tomorrow I hope).
To bypass it, the only way I can think of is to plot first an empty frame with the correct limits and then you draw the 2 graphs (without option “A”).

I have investigated the problem. In fact it can be easily bypass. That was a bit tricky to understand but I can explain clearly I hope. In your macro you set the log option after having used GetXaxis on the gr2 object. This method, GetXaxis(), needs to create the X axis for gr2 because, as the graph has not been plotted yet, it does not exist. In axis the limits definition method there is different algoritm depending if the axis is in log scale or not. When you call GetXaxis() the log scale has not been defined yet, that is why the axis limits definitions is wrong. Just move the setting of log scales before GetAxis(), just after the canvas creation. And it will work.