plt.plot(x, np.sin(x -0), color='blue')# 通过颜色名称指定 plt.plot(x, np.sin(x -1), color='g')# 通过颜色简写名称指定(rgbcmyk) plt.plot(x, np.sin(x -2), color='0.75')# 介于0-1之间的灰阶值 plt.plot(x, np.sin(x -3), color='#FFDD44')# 16进制的RRGGBB值 plt.plot...
cm.hot) #8:8+2=10,将高分为10部分, #alpha:透明度 #cmap:color map #use plt.contour to add contour lines C=plt.contour(X,Y,height(X,Y),8,colors=“black”,linewidth=.5) #adding label plt.clabel(C,inline=True,fontsize=10) #clabel:cycle的label,inline=True表示label在line内,fontsize...
x=np.arange(0,10,.1)y=np.arange(0,10,.1)X,Y=np.meshgrid(x,y)data=2*(np.sin(X)+np.sin(3*Y))fig,ax=plt.subplots()contour=ax.contour(X,Y,data)cbar=fig.colorbar(contour,ax=ax)cbar.set_ticks(np.linspace(0,10,10))# Set6ticks from0to10(inclusive)# cbar.set_ticklabels(...
mpl.rcParams['lines.color'] = 'r' 也可以通过matplotlib .rc一次设置多个参数 import matplotlib as mpl mpl.rc('lines', linewidth=2, color='r') 四、rc参数的说明 1. 线条 # 更多线条属性详情请查看 # http://matplotlib.sourceforge.net/api/artist_api.html#module-matplotlib.lines lines.linewidth ...
plt.barh(x,y,color='red') #在0位置垂直方向添加红色线条 plt.axvline(0,color='red',linewidth=3) plt.show() 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 例11:柱状图设置不同颜色 import matplotlib.pyplot as plt ...
plt.contour 与plt.contourf contour:轮廓,等高线 1.为等高线上注明等高线的含义: cs =plt.contour(x, y, z)plt.clabel(cs, inline=True, fontsize=10)#inline=True,表示高度写在等高线上 2.plt.contourf 与plt.contour 三维图像 参考文献 投影平面 ...
line_color='white')) fig.add_trace(go.Scatter( x=array_dict[f'x_{year}'], y=array_dict[f'y_{year}'] + (len(year_list) - index) +0.4, fill='tonexty', name=f'{year}')) # 添加文本 fig.add_annotation( x=-20, y=len(year_list) - index, ...
plot_data = [ ('d1', d1, 'b'), ('d2', d2, 'r'), ] for _, data, color in plot_data: sns.kdeplot(data, x='x', y='y', color=color) handles = [lines.Line2D([0], [0], color=color) for _, _, color in plot_data] labels = [name for name, _, _ in plot_...
plt.axvline(x=0,color='grey', zorder=-2)ifcmapisNone:ifconnect: ax.plot(self.x,self.y,'b-',lw=2,alpha=0.5) ax.scatter(self.x,self.y, marker='o', c='b', s=40)else:ifconnect:ifcmapin[cm.jet,cm.brg]: ax.plot(self.x,self.y,'c-',lw=2,alpha=0.5,zorder=-1)else: ...
axvline axvspan bar bar_label barbs barh bone box boxplot broken_barh cbook cla clabel clf clim close cm cohere colorbar colormaps connect contour contourf cool copper csd cycler delaxes disconnect docstring draw draw_all draw_if_interactive ...