numpy – 突出单一轮廓线
发布时间:2020-12-14 04:52:43 所属栏目:百科 来源:网络整理
导读:我正在制作一个简单的轮廓图,我希望通过使其更厚并改变颜色来突出显示零线. cs = ax1.contour(x,y,obscc)ax1.clabel(cs,inline=1,fontsize=8,fmt='%3.1f') 我该如何实现这一目标? 谢谢 :-) 解决方法 HTH – 这基本上是从 matplotlib docs获取的轮廓示例,只
我正在制作一个简单的轮廓图,我希望通过使其更厚并改变颜色来突出显示零线.
cs = ax1.contour(x,y,obscc) ax1.clabel(cs,inline=1,fontsize=8,fmt='%3.1f') 我该如何实现这一目标? 解决方法
HTH – 这基本上是从
matplotlib docs获取的轮廓示例,只是修改了水平线
从contour-method返回的对象在其collections属性中保存对轮廓线的引用. 在下面的代码片段中,对等高线图的引用是在CS中(在您的问题中是cs): CS.collections[0].set_linewidth(4) # the dark blue line CS.collections[2].set_linewidth(5) # the cyan line,zero level CS.collections[2].set_linestyle('dashed') CS.collections[3].set_linewidth(7) # the red line CS.collections[3].set_color('red') CS.collections[3].set_linestyle('dotted') type(CS.collections[0]) # matplotlib.collections.LineCollection 如果您没有明确指定它们,请参阅以下内容: CS.levels array([-1.,-0.5,0.,0.5,1.,1.5]) 格式化单个标签还有很多功能: CS.labelCValueList CS.labelIndiceList CS.labelTextsList CS.labelCValues CS.labelLevelList CS.labelXYs CS.labelFmt CS.labelManual CS.labels CS.labelFontProps CS.labelMappable CS.layers CS.labelFontSizeList CS.labelTexts (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |