pylab 由 三个部分组成:scipy, matplotlab, numpy三部分组成,安装时需要分别安装这三部分,在fedora中,可以使用命令:

sudo dnf install python-matplotlib python3-matplotlib
sudo dnf install scipy python3-scipy
sudo dnf install pylab python3-pylab

即可安装。

 

安装好后,可以简单尝试一下:

__author__ = 'emerald'

import numpy
import pylab

xVal = numpy.arange(0, 4 * numpy.pi, 0.1)
ySin = numpy.sin(xVal)  # y =sin(x)
yCos = numpy.cos(xVal)  # y = cos(x)
y3Cos = numpy.multiply(yCos, xVal)  #y = x * cos(x)
zero = numpy.multiply(yCos, 0)  # y = 0

pylab.title("Sine and Cosine plot")
pylab.plot(xVal, ySin, 'r')
pylab.plot(xVal, yCos, 'b')
pylab.plot(xVal, zero, '#000000')
pylab.plot(xVal, y3Cos, 'g')
pylab.show()

 

运行后可以看到:

fedora 安装pylab 并简单绘制三角函数

相关文章:

  • 2022-12-23
  • 2023-02-02
  • 2021-08-10
  • 2021-06-15
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2021-09-04
  • 2023-02-01
  • 2022-12-23
  • 2021-07-18
相关资源
相似解决方案