Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
gr102_reverse_graph.C File Reference

Detailed Description

View in nbviewer Open in SWAN
This example tests the reverse graphs obtained with Draw("a pl rx ry ") on a TGraph, where rx and ry refere to the reversing of x and y axis.

void gr102_reverse_graph() {
auto c = new TCanvas("c","Reversed graphs",0,0,900,400);
c->Divide(2,1); //Create a canvas with a 2x1 grid layout
auto gr = new TGraph();
gr->GetXaxis()->SetNdivisions(514);
gr->GetYaxis()->SetNdivisions(514);
gr->SetMarkerStyle(kCircle);
gr->SetMarkerColor(kBlue);
gr->SetLineColor(kRed);
gr->SetPoint(0,5,5);
gr->SetPoint(1,9,9);
gr->SetPoint(2,14,14);
c->cd(1);
gPad->SetGrid();
gr->Draw("a pl "); //Plot with axis ("a") and line+points ("pl")
c->cd(2);
gPad->SetGrid();
gr->Draw("a pl rx ry "); //Plot with axis ("a") and line+points ("pl") with reverse X and Y axes
}
#define c(i)
Definition RSha256.hxx:101
@ kRed
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
@ kCircle
Definition TAttMarker.h:58
#define gPad
The Canvas class.
Definition TCanvas.h:23
TGraphErrors * gr
Definition legend1.C:25
Author
Olivier Couet

Definition in file gr102_reverse_graph.C.