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 = & ...
随机推荐
- 《目标:OKR与KPI漫谈》
一.为什么要写这个 写这个题目其实是很偶然的,因为到年中了,公司的同事和领导都要看一下上半年的OKR的完成情况,同时也要制定下下半年的OKR,突然想到了之前在天津的公司时,大家说的是KPI,现在说的是 ...
- Azure Sphere Development Environment Setup
1. Visual Studio 目前,Visual Studio 2017/2019支持Azure Sphere开发,后续,微软会加入Visual Studio Code的支持.以Visual St ...
- mac--“-bash: brew: command not found”,怎么解决?
报错 “-bash: brew: command not found” 执行下面命令,安装HomeBrew ruby -e "$(curl -fsSL https://raw.githubu ...
- 05-Django模型(2)
1.特殊查询 F和Q查询: 之前的查询都是模型对象的属性与常量值比较,两个属性怎么比较呢?使用F查询. F查询语法: from django.db.models import F F('属性名称') ...
- 前端框架Easyui学习积累
前端框架Easyui学习积累 1.easyui textbox 赋值:$("#id").textbox("setValue","xx"); ...
- PVANET: Deep but Lightweight Neural Networks for Real-time Object Detection
URL: https://arxiv.org/abs/1608.08021 year: 2016 TL;DR PVANet 一个轻量级多物体目标检测架构, 遵循 "less channels ...
- Python的定时执行
最近手把手教妹子写Python,被一篇博客误导了,这里记录一下. 妹子需要的是一个定时闹钟,到点往钉钉群里推个消息.她一顿搜索猛如虎,参照着其他人的博客,搞了一个while: target_time ...
- JS 查找数组的父节点及祖先节点
function findAllParent(node, tree, parentNodes=[], index = 0){ if(!node || node.parentId === 0){ ret ...
- Java泛型类型擦除与运行时类型获取
Java的泛型大家都知道是类型擦除的方式实现的,“编译器会进行泛型擦除”是一个常识了(实际擦除的是参数和自变量的类型).“类型擦除” 并非像许多开发者认为的那样,在 <..> 符号内的东西 ...
- Python - ^在正则表达式中的作用
^在正则表达式中有两个作用,一是表达以什么开头,二是表达对什么取反.有时候经常傻傻的分不清楚,接下来给大家详细介绍该怎么用这个^准备一个python文件test.py,借用re.search函数举例说 ...