python3.5.3rc1学习六:画图
# 可以设置颜色,g代表green, r代表red,y代表yellow,b代表blue
# linewidth = 5,设置线条粗细
# label 设置线条名称
##plt.plot(x,y,'b',linewidth=5,label='Line One')
##plt.plot(x1,y1,'r',linewidth=8,label='Line Two')
# 绘制柱状图用bar函数
plt.bar(x, y ,color='g',label='Line One')
plt.bar(x1, y1 ,color='r',label='Line Two')
# 给这个图,添加标题和XY轴名称,注意这地方不能输入中文,matplotlib应该
# 对中文支持不好,写中文,会显示乱码,方块字
plt.title('Epic Chart')
plt.ylabel("Y axis")
plt.xlabel("X axis")
# 显示图例
plt.legend()
#显示网格
##plt.grid(True,color='k')
plt.show()
print("--------------------")
x = [5,6,7,8]
y = [7,3,8,3]
x1 = [2,5,3,9]
y1 = [5,3,2,7]
# 可以设置颜色,g代表green, r代表red,y代表yellow,b代表blue
# linewidth = 5,设置线条粗细
# label 设置线条名称
##plt.plot(x,y,'b',linewidth=5,label='Line One')
##plt.plot(x1,y1,'r',linewidth=8,label='Line Two')
# 绘制散点图用scatter函数
plt.scatter(x,y,color='g',label='Line One')
plt.scatter(x1,y1,color='y',label='Line Two')
# 给这个图,添加标题和XY轴名称,注意这地方不能输入中文,matplotlib应该
# 对中文支持不好,写中文,会显示乱码,方块字
plt.title('Epic Chart')
plt.ylabel("Y axis")
plt.xlabel("X axis")
# 显示图例
plt.legend()
#显示网格
##plt.grid(True,color='k')
plt.show()
参考:http://blog.csdn.net/u011541946/article/details/72898514
python3.5.3rc1学习六:画图的更多相关文章
- python3.5.3rc1学习十一:字典与模块
#os模块import oscurDir = os.getcwd()print(curDir) os.mkdir("新建") import timetime.sleep(2)os. ...
- python3.5.3rc1学习十:网络请求
#sys模块import sys sys.stderr.write('This is stderr text\n')# 因为从定向有缓冲区,所以需要以下这行代码sys.stderr.flush()sy ...
- python3.5.3rc1学习九:正则表达式
# 正则表达式 ''''' 正则表达式是有一些特殊字符组成,能够帮你找到一些符合一定规则的字符串 先来了解几个符号所代表的意思 \d 匹配所有的数字 \D 匹配所有,但是数字除外 \s 空格 \S 匹 ...
- python3.5.3rc1学习八:文件打包
from cx_Freeze import setup, Executable setup(name='test to exe', version = '0.1', description='test ...
- python3.5.3rc1学习七:多线程
import threading def exampleFun(): #打印当前激活的线程数量 print(threading.active_count) #查看上面激活的线程是哪几个 print(t ...
- python3.5.3rc1学习五:模块
#比较大小#name:maxNumber.py#比较两个数大小#C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\Lib\site- ...
- python3.5.3rc1学习五:列表与元组
#元组和列表 #元组定义x = 5,6,2,6 #or x = (5,6,2,6) #列表定义 y = [5,6,2,6] # 元组的使用,我们用return语句来演示 def exampleFunc ...
- python3.5.3rc1学习四:类
class calculator: def add(x,y): return x + y print(added) def sub(x,y): return x - y print(sub) def ...
- python3.5.3rc1学习三:文件操作
##全局变量与局部变量x = 6 def printFuc(): y = 8 z =9 print(y + z) print(x) printFuc()#print(y)#常见错误##name = & ...
随机推荐
- mtu测试
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/jeromezmzx007/article ...
- Node.js接口避免重复启动
众所周知,一个Node接口要是想被调用,得先在命令行中执行如下代码来启动接口 node base.js 但是一旦修改了base.js,就得重新执行这句命令 注:这里的base.js是我的node接口文 ...
- 去除mysql里面重复的行并留下id最小的
DELETE FROM wynews WHERE title IN (SELECT * FROM (SELECT title FROM wynews GROUP BY title HAVING COU ...
- HDU1075 What Are You Talking About(map)
传送门 题目大意:一个单词对应另一个单词 翻译一段文字 题解:stl map走一波 代码: #include<iostream> #include<map> #include& ...
- css的伪元素 ::after ::before 和 图标字体的使用
浅谈css的伪元素::after和::before css中的::after和::before已经被大量地使用在我们日常开发中了,使用他们可以使我们的文档结构更加简洁.但是很多人对::after和 ...
- eclipse强行停止buliding workspace
使用Eclipse的过程中可能会遇到buliding workspace卡在一半走不动的情况. 出现这个情况往往是因为Eclipse太调皮了,需要拉出去打屁股,打一顿就好了. 开玩笑的,事实上出现这个 ...
- 练手WPF(二)——2048游戏的简易实现(上)
1.创建游戏界面编辑MainWindow.xaml,修改代码如下: <Window.Resources> <Style TargetType="Label"> ...
- LeetCode题解001:两数之和
两数之和 题目 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标 你可以假设每种输入只会对应一个答案.但是,你不能重复利用这个 ...
- C# virtual 和 abstract 区别
Virtual方法(虚方法) virtual 关键字用于在基类中修饰方法.virtual的使用会有两种情况: 情况1:在基类中定义了virtual方法,但在派生类中没有重写该虚方法.那么在对派生类实例 ...
- uni-app自定义导航栏按钮|uniapp仿微信顶部导航条
最近一直在学习uni-app开发,由于uniapp是基于vue.js技术开发的,只要你熟悉vue,基本上很快就能上手了. 在开发中发现uni-app原生导航栏也能实现一些顶部自定义按钮+搜索框,只需在 ...