python error: no module named pylab

后端 未结 7 1458
北海茫月
北海茫月 2020-12-12 16:12

I am new to Python and want to use its plot functionality to create graphs. I am using ubuntu 12.04. I followed the Python installation steps from http://eli.th

7条回答
  •  既然无缘
    2020-12-12 16:34

    With the addition of Python 3, here is an updated code that works:

    import numpy as n
    import scipy as s
    import matplotlib.pylab as p #pylab is part of matplotlib
    
    xa=0.252
    xb=1.99
    
    C=n.linspace(xa,xb,100)
    print(C)
    iter=1000
    Y = n.ones(len(C))
    
    for x in range(iter):
        Y = Y**2 - C   #get rid of early transients
    
    for x in range(iter): 
        Y = Y**2 - C
        p.plot(C,Y, '.', color = 'k', markersize = 2)
    
    p.show()
    

提交回复
热议问题