i need to draw a cartesian plane. it means that the axis zero has to be in the center of the canvas and coincide for both axes. i didn’t find any way to do it. can you help me?
thanks
luca
{
c = new TCanvas("c","XY plot",200,10,700,500);
c->SetFillColor(0);
c->SetBorderSize(2);
c->SetFrameLineColor(10);
c->SetFrameBorderMode(0);
const Int_t n = 4;
Double_t x[n] = {-1, -3, -9, 3};
Double_t y[n] = {-1000, 900, 300, 300};
gr = new TGraph(n,x,y);
gr->SetTitle("XY plot");
gr->SetMinimum(-1080);
gr->SetMaximum(1080);
gr->Draw("AC*");
gr->GetHistogram()->GetYaxis()->SetTickLength(0);
gr->GetHistogram()->GetXaxis()->SetTickLength(0);
gr->GetHistogram()->GetYaxis()->SetLabelOffset(999);
gr->GetHistogram()->GetXaxis()->SetLabelOffset(999);
gr->GetHistogram()->GetXaxis()->SetAxisColor(0);
gr->GetHistogram()->GetYaxis()->SetAxisColor(0);
gPad->Update();
TGaxis *yaxis = new TGaxis(0, gPad->GetUymin(),
0, gPad->GetUymax(),
gPad->GetUymin(),gPad->GetUymax(),6,"+LN");
yaxis->Draw();
TGaxis *xaxis = new TGaxis(gPad->GetUxmin(), 0,
gPad->GetUxmax(), 0,
gPad->GetUxmin(),gPad->GetUxmax(),510,"+L");
xaxis->Draw();
}