// $Id$ // Author: Peter Barnes 2009-05, LLNL #include #include "TCanvas.h" #include "TPad.h" #include "TGraph.h" using namespace std; //______________________________________________________________________________ void AxisTitlesBug(bool log = true) { // Steep function const int npts = 20; const double scale = 3; double x[npts], y[npts]; for (int i = 0; i < npts; i++) { //x[i] = pow(10, (double)i*scale/npts); //y[i] = (1+log(x[i]))/pow(x[i],2); x[i] = pow(10, (double)i/npts); y[i] = exp(-x[i]); // cout<<"\t"<SetLineColor(38); g1->SetMarkerColor(kBlue); g1->SetMarkerStyle(21); g1->SetMarkerSize(1.1); g1->GetXaxis()->SetTitle("X Axis"); g1->GetYaxis()->SetTitle("Y Axis"); // Create a new canvas. TCanvas *c1 = new TCanvas("AxisTitleDemo","Axis Title Demo", 10, 10, 800,400); c1->Divide(2,1); // Correctly labeled c1->cd(1); g1->SetTitle("Both Axes Labeled"); g1->DrawClone("ALP"); // No labels c1->cd(2); g1->SetTitle("No Titles with Log Axes"); g1->DrawClone("ALP"); if (log) { gPad->SetLogx(); //gPad->SetLogy(); } }