python matplotlib 画图
来源:互联网 发布:如何使用spss分析数据 编辑:程序博客网 时间:2024/05/17 08:59
python matplotlib 画图
author@jason_ql(lql0716)
http://blog.csdn.net/lql0716
1、代码
# -*- coding: utf-8 -*-"""Created on Thu Jul 06 21:59:39 2017@author: lql0716"""import numpy as npimport matplotlib.pyplot as pltx = np.arange(-20,20) #自变量xy = x**2 #变量yplt.figure(num = 3, figsize = (8, 12), dpi = 100) #设置画图的图片的大小,figsize大概为厘米尺寸,分辨率dpiplt.plot(x, y, 'r*', label = 'line', linewidth = 3)plt.title('Function') # 标题plt.xlabel('x (cm)') # x轴的名称plt.ylabel('y (cm)') # y轴的名称xt = np.arange(-20,20, 10) #设置x轴刻度步长plt.xticks(xt)yt = np.arange(0, 400, 20) #设置y轴刻度步长plt.yticks(yt)plt.legend(loc = 0) #参数loc,设置label在图中的位置,含义如下#'best' : 0, (only implemented for axes legends)(自适应方式)#'upper right' : 1,#'upper left' : 2,#'lower left' : 3,#'lower right' : 4,#'right' : 5,#'center left' : 6,#'center right' : 7,#'lower center' : 8,#'upper center' : 9,#'center' : 10,plt.grid(True) #True表示显示网格线,其它参数linestyle 设置线显示的类型(一共四种), color 设置网格的颜色, linewidth 设置网格的宽度#plt.grid(True, linestyle = "-.", color = "r", linewidth = "3") plt.savefig("D:/photo/1-1.jpg") #保存绘制的图片plt.show()
2、效果图
阅读全文
0 0
- Python matplotlib 画图相关
- python matplotlib 画图简介
- 使用python matplotlib画图
- Python Matplotlib画图示例
- python使用matplotlib画图
- python用matplotlib画图
- python画图:matplotlib(1)
- 【python】matplotlib画图
- python matplotlib 画图
- Python matplotlib画图表
- Python:Matplotlib 画图
- Python中matplotlib画图
- python画图包matplotlib
- python matplotlib 画图一
- python matplotlib画图
- Python之Matplotlib画图方法
- python的画图模块matplotlib
- windows下python画图matplotlib
- 76总结
- java类加载过程
- eclipse 使用user Library报空指针异常
- 【电力项目】pub.js实现替换form表单的innerHTML
- online learning,batch learning&批量梯度下降,随机梯度下降
- python matplotlib 画图
- 《Inside C#》笔记(十一) 运算符重载
- Mysql优化总结
- shell命令之mkdir
- zxing生产二维码
- Mac 下搭建redis环境
- 2017.7.06 学习记录 Servlet03
- Appium基础篇1-如何在windows上安装Appium环境
- Jquery easyui教程