Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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.

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->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:66
@ kBlue
Definition Rtypes.h:66
@ kCircle
Definition TAttMarker.h:56
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gPad
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition TAttAxis.cxx:233
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:39
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:41
The Canvas class.
Definition TCanvas.h:23
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2347
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:833
TAxis * GetXaxis() const
Get x axis of the graph.
Definition TGraph.cxx:1568
TAxis * GetYaxis() const
Get y axis of the graph.
Definition TGraph.cxx:1577
TGraphErrors * gr
Definition legend1.C:25
Author
Olivier Couet

Definition in file gr102_reverse_graph.C.