本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT.edit_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.edit_parameters方法的具体用法?Python NavigationToolbar2QT.edit_parameters怎么用?Python NavigationToolbar2QT.edit_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.edit_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Interact
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import edit_parameters [as 别名]
#.........这里部分代码省略.........
self.axes.set_ylim(self.ylim)
self.axes.set_xscale(self.xlogscale)
self.axes.set_yscale(self.ylogscale)
for ax in self.axes, self.axes2:
ax.set_aspect('equal' if self.axisequal else 'auto', 'box-forced')
legend = self.axes.legend(self.handles.values(),
[k[0] for k in self.handles.keys()])
legend.draggable(True)
self.pickers = [picker(ax) for ax in [self.axes, self.axes2]]
self.canvas.draw()
def draw_warnings(self):
self.axes.text(0.05, 0.05, '\n'.join(self.warnings),
transform=self.axes.transAxes, color='red')
def canvas_key_press(self, event):
key_press_handler(event, self.canvas, self.mpl_toolbar)
if event.key == 'ctrl+q':
self._close()
elif event.key in mpl.rcParams['keymap.home']:
self.xlim = self.ylim = None
self.draw()
elif event.key == 'ctrl+x':
self.set_xlim(draw=False)
elif event.key == 'ctrl+y':
self.set_ylim(draw=False)
elif event.key == 'ctrl+l':
self.draw()
self.xlogscale = self.axes.get_xscale()
self.ylogscale = self.axes.get_yscale()
def edit_parameters(self):
xlim = self.axes.get_xlim()
ylim = self.axes.get_ylim()
self.mpl_toolbar.edit_parameters()
if xlim != self.axes.get_xlim():
self.xlim = self.axes.get_xlim()
if ylim != self.axes.get_ylim():
self.ylim = self.axes.get_ylim()
self.xlogscale = self.axes.get_xscale()
self.ylogscale = self.axes.get_yscale()
def _margins(self):
self.margins = 0 if self.margins else 0.05
self.draw()
def _options(self):
self.edit_parameters()
def _close(self):
self.app.references.discard(self)
self.window().close()
def _input_lim(self, axis, default):
default = text_type(default)
if re.match(r'^\(.*\)$', default) or re.match(r'^\[.*\]$', default):
default = default[1:-1]
text, ok = QtGui.QInputDialog.getText(
self, 'Set axis limits', '{} limits:'.format(axis),
QtGui.QLineEdit.Normal, default)
if ok:
try:
return eval(text_type(text), CONSTANTS.copy())
except Exception: