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 = & ...
随机推荐
- 苏州市java岗位的薪资状况(2)
上一篇已经统计出了起薪最高的top 10: 接着玩,把top 10 中所有职位的详细信息爬取下来.某一职位的详情是这样: 我们需要把工作经验.学历.职能.关键字爬取下来. from urllib.re ...
- day94_11_26爬虫find与findall
一.使用json 正常的,如果需要将response结果序列化,需要将结果json.loads res1=json.loads(response.text) 但是这样会很麻烦,request提供了js ...
- AcWing 801. 二进制中1的个数
网址 https://www.acwing.com/solution/AcWing/content/2066/ 题目描述给定一个长度为n的数列,请你求出数列中每个数的二进制表示中1的个数. 算法1主要 ...
- php 压缩字符串
压缩字符串: base64_encode(gzcompress(serialize($data))) 解压字符串: unserialize(gzuncompress(base64_decode($se ...
- NRF51822/NRF51802/NRF52832/NRF52810/NRF52811/NRF52840内核对比
NRF51822的内核为M0,FLASH是256K,RAM是16K,蓝牙BLE4.0/4.2(SDK新版本支持4.2)NRF51802的内核为M0,FLASH是256K,RAM是16K,蓝牙BLE4. ...
- 【shell脚本语法】判断、流程控制语句
目录 判断用户参数 流程控制语句 一.判断用户参数 1.1 文件判断参数 PS:$?代表上一个命令的返回值,为0表示正确执行,非0表示错误执行.详情可参考我另一篇博客:https://www.cnbl ...
- 使用logging模块进行封装,让bug无处遁寻
import logging from scripts.handle_config import conf from scripts.constants import LOGS_DIR class H ...
- linux远程执行ssh禁用交互方法
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${user}@${ip} ${cmd}
- Ubuntu桌面版安装小记
之前一直是用Ubuntu的桌面版装docker,桌面版本身用起来比较方便,但开销较大,如果建立多个虚拟机就比较费劲了.今天试了一下server版的Ubuntu,发现还是比较方便的,相比桌面版,有如下好 ...
- Python 自定义元类的两种写法
有关元类是什么大家自己搜索了解,我这里写一下实现元类的两种写法 # 自定义元类 #继承type class LowercaseMeta(type): ''' 修改类的属性名称为小写的元类 ''' # ...