# 可以设置颜色,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学习六:画图的更多相关文章

  1. python3.5.3rc1学习十一:字典与模块

    #os模块import oscurDir = os.getcwd()print(curDir) os.mkdir("新建") import timetime.sleep(2)os. ...

  2. python3.5.3rc1学习十:网络请求

    #sys模块import sys sys.stderr.write('This is stderr text\n')# 因为从定向有缓冲区,所以需要以下这行代码sys.stderr.flush()sy ...

  3. python3.5.3rc1学习九:正则表达式

    # 正则表达式 ''''' 正则表达式是有一些特殊字符组成,能够帮你找到一些符合一定规则的字符串 先来了解几个符号所代表的意思 \d 匹配所有的数字 \D 匹配所有,但是数字除外 \s 空格 \S 匹 ...

  4. python3.5.3rc1学习八:文件打包

    from cx_Freeze import setup, Executable setup(name='test to exe', version = '0.1', description='test ...

  5. python3.5.3rc1学习七:多线程

    import threading def exampleFun(): #打印当前激活的线程数量 print(threading.active_count) #查看上面激活的线程是哪几个 print(t ...

  6. python3.5.3rc1学习五:模块

    #比较大小#name:maxNumber.py#比较两个数大小#C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\Lib\site- ...

  7. python3.5.3rc1学习五:列表与元组

    #元组和列表 #元组定义x = 5,6,2,6 #or x = (5,6,2,6) #列表定义 y = [5,6,2,6] # 元组的使用,我们用return语句来演示 def exampleFunc ...

  8. python3.5.3rc1学习四:类

    class calculator: def add(x,y): return x + y print(added) def sub(x,y): return x - y print(sub) def ...

  9. python3.5.3rc1学习三:文件操作

    ##全局变量与局部变量x = 6 def printFuc(): y = 8 z =9 print(y + z) print(x) printFuc()#print(y)#常见错误##name = & ...

随机推荐

  1. express搭建后端请求路由,前端进行访问对应的接口 后端解决跨域

    代码在 ==>E:\nodes实战\myserve\testserve 1 express搭建后端请求路由,前端进行访问对应的接口 1) 创建项目目录 express 项目名 -e 然后按照提示 ...

  2. poj 3253 Fence Repair 贪心 最小堆 题解《挑战程序设计竞赛》

    地址 http://poj.org/problem?id=3253 题解 本题是<挑战程序设计>一书的例题 根据树中描述 所有切割的代价 可以形成一颗二叉树 而最后的代价总和是与子节点和深 ...

  3. python服务不能在docker容器里运行的问题

    在开发过程中,我们将mysql.redis.celery等服务在docker容器里跑,项目在本地运行,便于debug调试 docker-compose -f docker-compose-dev.ym ...

  4. python学习第一天第二天总结

    变量赋值 1, 变量由字⺟, 数字,下划线搭配组合⽽成 2, 不可以⽤数字开头,更不能是全数字 3,不能是pythond的关键字, 这些符号和字⺟已经被python占⽤, 不可以更改 4,不要⽤中⽂ ...

  5. pytest框架之rerunfailures失败重运行机制

    web自动化测试中,稳定性在整个测试运行中都至关重要,但不能保证测试脚本或者测试环境一直都能够稳定,它牵扯到诸多因素,在这里就不赘述,pytest框架相较于unittest的一大优势就在于拥有用例失败 ...

  6. 轻量级监控平台之java进程监控脚本

    轻量级监控平台之java进程监控脚本 #!/bin/bash #进程监控脚本 #功能需求: 上报机器Java进程的进程ID,对应的端口号service tcp端口号,tomcat http 端口号,以 ...

  7. PAT 1002 A+B for Polynomials(map模拟)

    This time, you are supposed to find A+B where A and B are two polynomials(多项式). Input Each input fil ...

  8. springboot深入浅出系列(16章97节)-看了都说好

    章节目录 第一章 spring boot 2.x基础及概念入门 1.1.spring boot 产生的背景及其优势 1.2.spring boot 2.x 新特性说明 1.3.helloworld及项 ...

  9. IDA中查看某函数引用问题

    按X键,即可列出哪个部分引用该函数.

  10. asp.net 使用NPOI读取excel文件

    asp.net 使用NPOI读取excel文件内容 NPOI下载地址:NPOI public class ExcelHelper { /// <summary> /// 读取Excel文件 ...