本文整理汇总了Python中matplotlib.offsetbox.TextArea.set_visible方法的典型用法代码示例。如果您正苦于以下问题:Python TextArea.set_visible方法的具体用法?Python TextArea.set_visible怎么用?Python TextArea.set_visible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.offsetbox.TextArea
的用法示例。
在下文中一共展示了TextArea.set_visible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Legend
# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_visible [as 别名]
#.........这里部分代码省略.........
if self._legend_title_box:
children.append(self.get_title())
return children
def get_frame(self):
'return the Rectangle instance used to frame the legend'
return self.legendPatch
def get_lines(self):
'return a list of lines.Line2D instances in the legend'
return [h for h in self.legendHandles if isinstance(h, Line2D)]
def get_patches(self):
'return a list of patch instances in the legend'
return silent_list('Patch', [h for h in self.legendHandles if isinstance(h, Patch)])
def get_texts(self):
'return a list of text.Text instance in the legend'
return silent_list('Text', self.texts)
def set_title(self, title, prop=None):
"""
set the legend title. Fontproperties can be optionally set
with *prop* parameter.
"""
self._legend_title_box._text.set_text(title)
if prop is not None:
if isinstance(prop, dict):
prop = FontProperties(**prop)
self._legend_title_box._text.set_fontproperties(prop)
if title:
self._legend_title_box.set_visible(True)
else:
self._legend_title_box.set_visible(False)
def get_title(self):
'return Text instance for the legend title'
return self._legend_title_box._text
def get_window_extent(self, *args, **kwargs) :
'return a extent of the the legend'
return self.legendPatch.get_window_extent(*args, **kwargs)
def get_frame_on(self):
"""
Get whether the legend box patch is drawn
"""
return self._drawFrame
def set_frame_on(self, b):
"""
Set whether the legend box patch is drawn
ACCEPTS: [ *True* | *False* ]
"""
self._drawFrame = b
def get_bbox_to_anchor(self):
"""
return the bbox that the legend will be anchored
"""
if self._bbox_to_anchor is None:
return self.parent.bbox
示例2: Legend
# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_visible [as 别名]
#.........这里部分代码省略.........
return children
def get_frame(self):
'return the Rectangle instance used to frame the legend'
return self.legendPatch
def get_lines(self):
'return a list of lines.Line2D instances in the legend'
return [h for h in self.legendHandles if isinstance(h, Line2D)]
def get_patches(self):
'return a list of patch instances in the legend'
return silent_list('Patch',
[h for h in self.legendHandles
if isinstance(h, Patch)])
def get_texts(self):
'return a list of text.Text instance in the legend'
return silent_list('Text', self.texts)
def set_title(self, title, prop=None):
"""
set the legend title. Fontproperties can be optionally set
with *prop* parameter.
"""
self._legend_title_box._text.set_text(title)
if prop is not None:
if isinstance(prop, dict):
prop = FontProperties(**prop)
self._legend_title_box._text.set_fontproperties(prop)
if title:
self._legend_title_box.set_visible(True)
else:
self._legend_title_box.set_visible(False)
self.stale = True
def get_title(self):
'return Text instance for the legend title'
return self._legend_title_box._text
def get_window_extent(self, *args, **kwargs):
'return a extent of the legend'
return self.legendPatch.get_window_extent(*args, **kwargs)
def get_frame_on(self):
"""
Get whether the legend box patch is drawn
"""
return self._drawFrame
def set_frame_on(self, b):
"""
Set whether the legend box patch is drawn
ACCEPTS: [ *True* | *False* ]
"""
self._drawFrame = b
self.stale = True
def get_bbox_to_anchor(self):
"""
return the bbox that the legend will be anchored
"""
if self._bbox_to_anchor is None:
示例3: Legend
# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_visible [as 别名]
#.........这里部分代码省略.........
if self._legend_box:
children.append(self._legend_box)
children.append(self.get_frame())
return children
def get_frame(self):
'''
Return the `~.patches.Rectangle` instances used to frame the legend.
'''
return self.legendPatch
def get_lines(self):
'Return a list of `~.lines.Line2D` instances in the legend.'
return [h for h in self.legendHandles if isinstance(h, Line2D)]
def get_patches(self):
'Return a list of `~.patches.Patch` instances in the legend.'
return silent_list('Patch',
[h for h in self.legendHandles
if isinstance(h, Patch)])
def get_texts(self):
'Return a list of `~.text.Text` instances in the legend.'
return silent_list('Text', self.texts)
def set_title(self, title, prop=None):
"""
Set the legend title. Fontproperties can be optionally set
with *prop* parameter.
"""
self._legend_title_box._text.set_text(title)
if title:
self._legend_title_box._text.set_visible(True)
self._legend_title_box.set_visible(True)
else:
self._legend_title_box._text.set_visible(False)
self._legend_title_box.set_visible(False)
if prop is not None:
if isinstance(prop, dict):
prop = FontProperties(**prop)
self._legend_title_box._text.set_fontproperties(prop)
self.stale = True
def get_title(self):
'Return the `.Text` instance for the legend title.'
return self._legend_title_box._text
def get_window_extent(self, renderer=None):
'Return extent of the legend.'
if renderer is None:
renderer = self.figure._cachedRenderer
return self._legend_box.get_window_extent(renderer=renderer)
def get_tightbbox(self, renderer):
"""
Like `.Legend.get_window_extent`, but uses the box for the legend.
Parameters
----------
renderer : `.RendererBase` instance
renderer that will be used to draw the figures (i.e.
``fig.canvas.get_renderer()``)