Python可视化学习笔记一

来源:互联网 发布:淘宝可以多久确认收货 编辑:程序博客网 时间:2024/06/05 19:33

from matplotlib.pyplot import *
import matplotlib.pyplot as plt

def learn_1():
#plot储存数据集,多组数据展现多条线
”’
plot([1,2,3,2,3,2,2,1])
plot([4,3,2,1],[1,2,3,4])
”’
x=[1,2,3,4]
y=[5,4,3,2]
figure()

subplot(231)plot(x,y)subplot(232)bar(x,y)subplot(233)barh(x,y)subplot(234)bar(x,y)y1=[7,8,5,3]bar(x,y1,bottom=y,color='r')subplot(235)boxplot(x)subplot(236)scatter(x,y)plt.show()

if name == ‘main‘:
learn_1()
此代码分4部分:
1、导入合适的包
2、建立数据源
3、划分子图板块
4、函数调用显示

原创粉丝点击