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 ?

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

Double_t rms[10] =
{0.123921,.361778,0.6635,1.262,2.45166,3.0177,5.94486,11.669,23.0964,113.815};
Double_t grms[10] =
{0.02235,0.05,0.0707,0.0999,0.14138,0.15814,0.223508,0.316279,0.447409,.998765};
Double_t rrms[10] =
{.123921,0.27791,.396317,.558727,.788838,.880168,1.25266,1.76173,2.55225,5.2410$

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”);
g2r.SetTitle("");

gPad->SetLogx();
gPad->SetLogy();

g2r.SetMarkerColor(1);
g2r.SetMarkerStyle(20);
g2r.SetMarkerSize(1);
g3r.SetMarkerColor(1);
g3r.SetMarkerStyle(21);
g3r.SetMarkerSize(1);
g2r.SetMaximum(10);
g2r.SetMinimum(.01);

g2r.Draw(“AP”);
g3r.SetMarkerColor(4);
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] =
{.123921,0.27791,.396317,.558727,.788838,.880168,1.25266,1.76173,2.55225,5.2410};

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.