Segmentation fault

I have program:

 cat p1.py
import ROOT
import numpy as n

x = n.linspace(0, 4*n.pi,101)
y = n.cos(x)

g = ROOT.TGraph(len(x), x,y)
g.SetTitle("cosine in x=[%.1f, %.1f]" % (x[0], x[-1]))
g.GetXaxis().SetTitle("x")
g.GetYaxis().SetTitle("y")
g.Draw("AL")

This program generates an error:

$ python p1.py 
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Segmentation fault (core dumped)

do you know on which line it crashes ?

Hi,

and which version of ROOT, as “it works fine for me.”

Cheers,
Wim

I have ROOT 5.34/14.
I do not know which line it crashes.

can you try to change the order of instructions.

  1. Draw
  2. gPad->Update()
  3. GetAxis …