![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
matplotlib
桉夏与猫
啥啥啥?这都是啥?
展开
-
matplotlib学习——案例五:计算两个信号的互谱密度(Compute the cross spectral density of two signals)
import numpy as npimport matplotlib.pyplot as pltfig,(ax1,ax2) = plt.subplots(2,1)#调整边距和子图的间距fig.subplots_adjust(hspace=0.5)dt = 0.01t = np.arange(0,30,dt)np.random.seed(19680801)#创建两个白噪声nse1 = np.random.randn(len(t))nse2 = np.random.randn(len(.原创 2021-03-24 15:06:35 · 702 阅读 · 0 评论 -
matplotlib学习——案例四:绘制两个信号的相干性(Plotting the coherence of two signals)
import numpy as npimport matplotlib.pyplot as pltnp.random.seed(19680801)dt = 0.01t = np.arange(0,30,dt)nse1 = np.random.randn(len(t))nse2 = np.random.randn(len(t))s1 = np.sin(2*np.pi*10*t)+nse1s2 = np.sin(2*np.pi*10*t)+nse2fig,axs = plt.subp.原创 2021-03-22 19:26:35 · 812 阅读 · 0 评论 -
matplotlib学习——案例三:横条图(Horizontal bar chart)
import matplotlib.pyplot as pltimport numpy as npnp.random.seed(19680801)# 重置rc所有参数,类似初始化plt.rcdefaults()figure,ax = plt.subplots()#创建数据people=["Tom","Dick","Harry","Slim","Jim"]y_pos = np.arange(len(people))performance = 3+10*np.random.rand(len.原创 2021-03-19 16:58:16 · 645 阅读 · 0 评论 -
matplotlib学习——案例二:带标签的分组条形图(Grouped bar chart with labels)
import matplotlib.pyplot as pltimport numpy as nplabels=['G1','G2','G3','G4','G5']men_means=[20,34,30,35,37]women_means=[25,32,34,20,25]#x轴是由[1,2,3,4,5]组成x=np.arange(len(labels))width = 0.35fig,ax = plt.subplots()#先画第一个男性矩形rects1=ax.bar(x-wid.原创 2021-03-18 15:00:13 · 2962 阅读 · 0 评论 -
matplotlib学习——案例(Stacked bar chart)
import matplotlib.pyplot as plt#设置横坐标的类别labels=['G1','G2','G3','G4','G5']#下面四个列表分别代表男生的数值,女生的数值,男生的误差,女生的误差men_means=[20,35,30,35,27]women_means=[25,32,34,20,25]men_std = [2,3,4,1,2]women_std = [3,5,2,3,3]#设置宽度width=0.35创建画布与图形fig,ax = plt.subp.原创 2021-03-18 10:07:30 · 2190 阅读 · 0 评论