基本使用

import matplotlib.pyplot as plt
import numpy as np x = np.linspace(-1,1,50)
y = 2*x+1
plt.figure(num=2,figsize=(8,5))
plt.plot(x,y) plt.figure(num=1)
y2 = x**2
plt.plot(x,y2,color='red',linewidth=1.0,linestyle='--') # 默认 线宽为1
plt.show()

感受一波被繁多参数支配的恐惧

import matplotlib.pyplot as plt
import numpy as np x = np.linspace(-4,4,10)
y = 2*x+1 ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none') xaxis = ax.xaxis
yaxis = ax.yaxis
xaxis.set_ticks_position('bottom')
yaxis.set_ticks_position('left') left_ax = ax.spines['left']
bottom_ax = ax.spines['bottom']
left_ax.set_color('red')
bottom_ax.set_color('green') left_ax.set_position(('data',0))
bottom_ax.set_position(('data',0)) x0 = 1
y0 = 2*x0+1
plt.scatter(x0,y0,s=50,color='b') plt.plot([x0,x0],[y0,0],'k--',linewidth=2.5)
plt.annotate(r'$2x+1=%s$' %y0,xy=(x0,y0),xycoords='data',xytext=(+30,-30),textcoords='offset points',fontsize=16,arrowprops=dict(arrowstyle='->',connectionstyle='arc3,rad=.2'))
plt.text(-7,3,r'$This\ is\ the\ some text.\ \mu\ \sigma_i\ \alpha_t $',fontdict={'size':16,'color':'red'})
plt.plot(x,y,color='b')
plt.show()

python matplotlib 库学习的更多相关文章

  1. 吴裕雄--天生自然Python Matplotlib库学习笔记:matplotlib绘图(1)

    Matplotlib 可能是 Python 2D-绘图领域使用最广泛的套件.它能让使用者很轻松地将数据图形化,并且提供多样化的输出格式. from pylab import * size = 128, ...

  2. 吴裕雄--天生自然Python Matplotlib库学习笔记:matplotlib绘图(2)

    import numpy as np import matplotlib.pyplot as plt fig = plt.figure() fig.subplots_adjust(bottom=0.0 ...

  3. numpy, matplotlib库学习笔记

    Numpy库学习笔记: 1.array()   创建数组或者转化数组 例如,把列表转化为数组 >>>Np.array([1,2,3,4,5]) Array([1,2,3,4,5]) ...

  4. 转:使用 python Matplotlib 库 绘图 及 相关问题

     使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc/article/details/9714163 Matplotlib ...

  5. 安装python Matplotlib 库

    转:使用 python Matplotlib 库 绘图 及 相关问题  使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc ...

  6. Python之matplotlib库学习:实现数据可视化

    1. 安装和文档 pip install matplotlib 官方文档 为了方便显示图像,还使用了ipython qtconsole方便显示.具体怎么弄网上搜一下就很多教程了. pyplot模块是提 ...

  7. python requests库学习笔记(上)

    尊重博客园原创精神,请勿转载! requests库官方使用手册地址:http://www.python-requests.org/en/master/:中文使用手册地址:http://cn.pytho ...

  8. python标准库学习-SimpleHTTPServer

    这是一个专题 记录学习python标准库的笔记及心得 简单http服务 SimpleHTTPServer 使用 python -m SimpleHTTPServer 默认启动8000端口 源码: &q ...

  9. Python——Matplotlib库入门

    1.Matplotlib库简介 优秀的可视化第三方库 Matplotlib库由各种可视化类构成,内部结构复杂,受Matlab启发 matplotlib.pyplot是绘制各类可视化图形的命令子库,相当 ...

随机推荐

  1. MT【312】特征根法求数列通项

    (2016清华自招领军计划37题改编) 设数列$\{a_n\}$满足$a_1=5,a_2=13,a_{n+2}=\dfrac{a^2_{n+1}+6^n}{a_n}$则下面不正确的是(      )A ...

  2. 【CodeForces 717C】Potions Homework

    BUPT 2017 summer training (for 16) #1G 题意 每个人有一个懒惰值,每个任务有个难度,一开始每个人的任务和懒惰值都为\(a_i\),完成任务时间是懒惰值乘以难度,现 ...

  3. Nagios 监控 Mysql

    被监控机的Mysql监控创建专用数据库.专用数据库账户mysql -uroot -pcreate database nagios_monitor;grant select on nagios_moni ...

  4. js定时器setInterval()与setTimeout()

    js定时器setInterval()与setTimeout() 1.setTimeout(Expression,DelayTime),在DelayTime过后,将执行一次Expression,setT ...

  5. A1034. Head of a Gang

    One way that the police finds the head of a gang is to check people's phone calls. If there is a pho ...

  6. django orm跨表查询废话最少最精简版

    在model.py中: class B1(models.Model): u1= models.CharField(max_length=32) #多 class B2(models.Model): f ...

  7. 【译】11. Java反射——动态代理

    原文地址:http://tutorials.jenkov.com/java-reflection/dynamic-proxies.html 博主最近比较忙,争取每周翻译四篇.等不急的请移步原文网页. ...

  8. layer.open窗口自适应问题

    宽高度 area : ['100%', '100%']同时取消layer.full(index)就能自适应

  9. halcon图像处理的基本思路

    原图素材,1.jpg 过程图: 结果图: 代码及注意事项: read_image (Image, 'C:/Users/Jv/Desktop/1.jpg') rgb1_to_gray (Image, G ...

  10. Tomcat源码组织结构

    Tomcat 源码组织结构 目录结构 这里所介绍的目录结构,是使用CATALINA-BASE变量定义的路径,如果没有通过配置多个CATALINA-BASE目录来使用多实例,则CATALINA-BASE ...