Movatterモバイル変換


[0]ホーム

URL:


You are reading an old version of the documentation (v2.0.0). For the latest version seehttps://matplotlib.org/stable/
matplotlib

Navigation


Travis-CI:

Related Topics

This Page

Quick search

pylab_examples example code: axes_demo.py

(Source code,png,pdf)

../../_images/axes_demo.png
importmatplotlib.pyplotaspltimportnumpyasnp# create some data to use for the plotdt=0.001t=np.arange(0.0,10.0,dt)r=np.exp(-t[:1000]/0.05)# impulse responsex=np.random.randn(len(t))s=np.convolve(x,r)[:len(x)]*dt# colored noise# the main axes is subplot(111) by defaultplt.plot(t,s)plt.axis([0,1,1.1*np.amin(s),2*np.amax(s)])plt.xlabel('time (s)')plt.ylabel('current (nA)')plt.title('Gaussian colored noise')# this is an inset axes over the main axesa=plt.axes([.65,.6,.2,.2],facecolor='y')n,bins,patches=plt.hist(s,400,normed=1)plt.title('Probability')plt.xticks([])plt.yticks([])# this is another inset axes over the main axesa=plt.axes([0.2,0.6,.2,.2],facecolor='y')plt.plot(t[:len(r)],r)plt.title('Impulse response')plt.xlim(0,0.2)plt.xticks([])plt.yticks([])plt.show()

Keywords: python, matplotlib, pylab, example, codex (seeSearch examples)

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team. Last updated on Feb 20, 2017. Created usingSphinx 1.5.2.

[8]ページ先頭

©2009-2025 Movatter.jp