# Trouble setting logarithmic axis scale

**URL:** <https://root-forum.cern.ch/t/trouble-setting-logarithmic-axis-scale/40928>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [August 9, 2020, 9:36pm UTC](https://root-forum.cern.ch/t/trouble-setting-logarithmic-axis-scale/40928 "2020-08-09T21:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mctran1724](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mctran1724/32/23065_2.png) [@Mctran1724](https://root-forum.cern.ch/u/Mctran1724)\
**Post date:** [August 9, 2020, 9:36pm UTC](https://root-forum.cern.ch/t/trouble-setting-logarithmic-axis-scale/40928/1 "2020-08-09T21:36:03Z")

</div>

Hello,

I am trying to create a scatterplot using pyroot where the y-axis is logarithmically scaled. The first and second columns of the efficiencies array are the data in question and we want to plot 1/efficiencies[1] vs. efficiencies[0]. For some reason, running this code gives the proper scatterplot but without the log scale. The y axis remains scaled linearly. Is there any workaround for this? Perhaps to create the log scale differently?

```auto
import numpy as np
import matplotlib.pyplot as plt
import sys

from ROOT import TCanvas, TFormula, TF1, TH1F, TH2F, TVectorF, TLegend, TH1, TPaveStats, TGraph
from ROOT import gROOT, gObjectTable, gStyle, TPad

def cleaner(inputarray):
    effsonly = inputarray[:, [0,1]]
    cleaned = [pair for pair in effsonly if pair[0] >= 1e-5]
    cleaned = np.asarray(cleaned)
    sigeff = cleaned[:,1]
    bgeffnon0 = cleaned[:,0]
    sig = np.array(sigeff)
    bg = np.array(1.0/bgeffnon0)
    return bg, sig

folder = "myfolder"

efficiencies = np.genfromtxt(folder + "AE_latent/totalROC.csv",delimiter=',')
bgeff, sigeff = cleaner(efficiencies)

scatter = TGraph(len(bgeff), bgeff, sigeff)
scatter.SetMarkerStyle(20)
scatter.SetMarkerSize(0.85)
scatter.SetMarkerColor(4)

scatter.SetTitle("ROC curves")
scatter.GetXaxis().SetTitle("Gluino Efficiency")
scatter.GetXaxis().CenterTitle()
scatter.GetYaxis().SetTitle("1/QCD Efficiency")
scatter.GetYaxis().CenterTitle()

legend = TLegend(0,0.3,0.4,0.7)
legend.SetTextFont(60)
legend.SetHeader("Legend","C")
legend.AddEntry(scatter, "ROC curve in question")
legend.SetEntrySeparation(0)

c4 = TCanvas ('c4', 'ROC')
c4.Divide(2,1)
c4.SetCanvasSize(1500, 750)
c4.cd(2)
legend.Draw()
c4.Update()
c4.cd(1)
scatter.Draw("AP")
c4.SetLogy()
c4.Update()
c4.Draw()

```

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [August 10, 2020, 6:30am UTC](https://root-forum.cern.ch/t/trouble-setting-logarithmic-axis-scale/40928/2 "2020-08-10T06:30:10Z")

</div>

Try SetLogy on the pad, something like

```auto
   c4->cd(1);
   gPad->SetLogy();
   scatter->Draw("AP");

```
