本文整理汇总了Python中matplotlib.collections.PatchCollection.set_visible方法的典型用法代码示例。如果您正苦于以下问题:Python PatchCollection.set_visible方法的具体用法?Python PatchCollection.set_visible怎么用?Python PatchCollection.set_visible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.collections.PatchCollection
的用法示例。
在下文中一共展示了PatchCollection.set_visible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimulationGui
# 需要导入模块: from matplotlib.collections import PatchCollection [as 别名]
# 或者: from matplotlib.collections.PatchCollection import set_visible [as 别名]
#.........这里部分代码省略.........
nbr_msg.destination = neighbor
c = MessageCircle(nbr_msg, net, 'out', 3.0, lw=0,
picker=3, zorder=3, color='b')
self.messages.append(nbr_msg)
msgCircles.append(c)
else:
c = MessageCircle(msg, net, 'out', 3.0, lw=0, picker=3,
zorder=3, color='b')
self.messages.append(msg)
msgCircles.append(c)
for msg in node.inbox:
c = MessageCircle(msg, net, 'in', 3.0, lw=0, picker=3,
zorder=3, color='g')
self.messages.append(msg)
msgCircles.append(c)
if self.messages:
self.message_collection = PatchCollection(msgCircles,
match_original=True)
self.message_collection.set_picker(3)
self.axes.add_collection(self.message_collection)
def draw_labels(self, net=None):
if not net:
net = self.net
label_pos = {}
for n in net.nodes():
label_pos[n] = net.pos[n].copy() + 10
self.label_collection = nx.draw_networkx_labels(net, label_pos,
labels=net.labels,
ax=self.axes)
def refresh_visibility(self):
try:
self.node_collection.set_visible(self.ui.showNodes.isChecked())
self.edge_collection.set_visible(self.ui.showEdges.isChecked())
for label in self.label_collection.values():
label.set_visible(self.ui.showLabels.isChecked())
self.tree_collection.set_visible(self.ui.treeGroupBox.isChecked())
self.ini_error_collection.set_visible(self.ui.propagationError\
.isChecked())
self.propagation_error_collection.set_visible(self.ui\
.propagationError\
.isChecked())
# sould be last, sometimes there are no messages
self.message_collection.set_visible(self.ui.showMessages\
.isChecked())
except AttributeError:
print 'Refresh visibility warning'
self.canvas.draw()
def draw_tree(self, treeKey, net=None):
"""
Show tree representation of network.
Attributes:
treeKey (str):
key in nodes memory (dictionary) where tree data is stored
storage format can be a list off tree neighbors or a dict:
{'parent': parent_node,
'children': [child_node1, child_node2 ...]}
"""
if not net:
net = self.net
treeNet = net.get_tree_net(treeKey)
if treeNet:
self.tree_collection = draw_networkx_edges(treeNet, treeNet.pos,