用matplotlib画线
2018-03-31 08:58
309 查看
就拿sin、cossin、cos来举例吧。
python代码:
图像:
python代码:
import matplotlib.pyplot as plt import numpy import math #创建x数组,区间是[0,4π],步长为0.1 x = numpy.arange(0, 4 * math.pi, 0.1) def sinFunction(x): sin = [math.sin(i) for i in x] return sin def cosFunction(x): cos = [math.cos(i) for i in x] return cos plt.plot(x, sinFunction(x), label='sin') plt.plot(x, cosFunction(x), label='cos') plt.legend() plt.show()
图像:
相关文章推荐
- python中matplotlib的颜色及线条控制的示例
- Python matplotlib绘图可视化知识点整理(小结)
- delphi 正弦曲线图
- C#绘制曲线图的方法
- Javascript 绘制 sin 曲线过程附图
- Java中使用COS实现文件上传功能
- JavaScript使用atan2来绘制箭头和曲线的实例
- pip matplotlib报错equired packages can not be built解决
- 学习python中matplotlib绘图设置坐标轴刻度、文本
- 在Linux下使用Python的matplotlib绘制数据图的教程
- Python通过matplotlib绘制动画简单实例
- Python中matplotlib中文乱码解决办法
- Python自定义简单图轴简单实例
- matplotlib中legend位置调整解析
- ubuntu系统下matplotlib中文乱码问题的解决方法
- 用matplotlib画等高线图详解
- Python使用matplotlib简单绘图示例
- Python模拟脉冲星伪信号频率实例代码
- Python Matplotlib库入门指南
- Python实现好玩的雨滴下落到地面的效果