matplotlib入门-绘制简单折线图
来源:互联网 发布:淘宝上的十字绣靠谱吗 编辑:程序博客网 时间:2024/05/11 22:24
# -*- coding: utf-8 -*-"""Spyder EditorThis is a temporary script file."""import matplotlib.pyplot as pltinput_values = [1, 2, 3, 4, 5]squares = [1, 4, 9, 16, 25]plt.plot(input_values, squares, linewidth=5)# 设置图表标题, 并给坐标轴加上标签plt.title("Square Numbers", fontsize=24)plt.xlabel("Value", fontsize=14)plt.ylabel("Square of Value", fontsize=14)# 设置刻度标记的大小plt.tick_params(axis='both', labelsize=14)plt.show()plt.scatter(2, 4, s=200)# 设置图表标题并给坐标轴加上标签plt.title("Square Numbers", fontsize=24)plt.xlabel("Value", fontsize=14)plt.ylabel("Square of Value", fontsize=14)# 设置刻度标记的大小plt.tick_params(axis='both', which='major', labelsize=14)plt.show()x_values = [1, 2, 3, 4, 5]y_values = [1, 4, 9, 16, 25]plt.scatter(x_values, y_values, s=100)plt.title("Square Numbers", fontsize=24)plt.xlabel("Value", fontsize=14)plt.ylabel("Square of Value", fontsize=14)# 设置刻度标记的大小plt.tick_params(axis='both', which='major', labelsize=14)plt.show()x_values = list(range(1, 1001))y_values = [x**2 for x in x_values]#plt.scatter(x_values, y_values, s=40)#默认为蓝色点和黑色轮廓,删除数据点的轮廓#plt.scatter(x_values, y_values, edgecolor='none', s=40)#自定义颜色#plt.scatter(x_values, y_values, c='red', edgecolor='none', s=40)plt.scatter(x_values, y_values, c=(0.5, 1, 0.8), edgecolor='none', s=40)#颜色映射#plt.scatter(x_values, y_values, c=y_values, cmap=plt.cm.Blues,edgecolor='none', s=40)# 设置图表标题并给坐标轴加上标签# 设置每个坐标轴的取值范围plt.axis([0, 1100, 0, 1100000])#打印图片#plt.show()#保存图片plt.savefig('D:\zwPython\py35\settings\.spyder-py3\squares_plot.png', bbox_inches='tight')
上传一张:
参考:《python编程入门到实战》
阅读全文
0 0
- matplotlib入门-绘制简单折线图
- 使用matplotlib绘制简单的折线图
- matplotlib plot( ) 绘制简单折线图
- Matplotlib绘制折线图
- python使用matplotlib绘制折线图教程
- 【Python-3.5】matplotlib绘制气温折线图
- matplotlib绘制折线图与散点图
- matplotlib绘制简单图
- python 数据可视化 matplotlib学习一:绘制简单的折线图
- MFC绘制简单折线图
- wxPython+Matplotlib绘制折线图表
- 【Python-3.5】matplotlib做简单折线图
- matplotlib入门——绘制简单图形
- Python学习之matplotlib 绘制折线图详解
- python matplotlib从文件中读取数据绘制折线图
- 简单使用achartengine绘制折线图
- 简单使用achartengine绘制折线图
- 简单使用achartengine绘制折线图
- applicationContext配置--ssh
- C++const/常量折叠
- 【JAVAWEB学习笔记】16
- IDEA搭建Spring项目(Maven版)
- 三栏网页宽度自适应布局方法
- matplotlib入门-绘制简单折线图
- 阿里物联网套件-服务端SDK学习实践(基础篇-13发布广播消息)
- 用jquery的ajax向前台提交数据
- Django使用微信分享接口(分享到朋友圈、朋友、空间)
- 用python统计代码行(包括空行和注释)
- LL(1)分析法_C++实现
- codeforces 811A Vladik and Courtesy
- HDU1276士兵队列训练问题 循环队列
- CentOS7下安装MySQL5.7安装与配置(YUM)