本文整理汇总了Python中matplotlib.collections.PolyCollection.set_gid方法的典型用法代码示例。如果您正苦于以下问题:Python PolyCollection.set_gid方法的具体用法?Python PolyCollection.set_gid怎么用?Python PolyCollection.set_gid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.collections.PolyCollection
的用法示例。
在下文中一共展示了PolyCollection.set_gid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __plot_variance
# 需要导入模块: from matplotlib.collections import PolyCollection [as 别名]
# 或者: from matplotlib.collections.PolyCollection import set_gid [as 别名]
def __plot_variance(self):
pointsMin = self.__calc_min()
pointsMax = self.__calc_max()
polys = []
variance = []
varMin = 1000
varMax = 0
lastX = None
lastYMin = None
lastYMax = None
for x in pointsMin.iterkeys():
if lastX is None:
lastX = x
if lastYMin is None:
lastYMin = pointsMin[x]
if lastYMax is None:
lastYMax = pointsMax[x]
polys.append([[x, pointsMin[x]],
[x, pointsMax[x]],
[lastX, lastYMax],
[lastX, lastYMin],
[x, pointsMin[x]]])
lastX = x
lastYMin = pointsMin[x]
lastYMax = pointsMax[x]
var = pointsMax[x] - pointsMin[x]
variance.append(var)
varMin = min(varMin, var)
varMax = max(varMax, var)
norm = Normalize(vmin=varMin, vmax=varMax)
sm = ScalarMappable(norm, self.colourMap)
colours = sm.to_rgba(variance)
pc = PolyCollection(polys)
pc.set_gid('plot')
pc.set_norm(norm)
pc.set_color(colours)
self.axes.add_collection(pc)
return None, None