本文整理汇总了Python中matplotlib.backends.qt_editor.figureoptions.figure_edit方法的典型用法代码示例。如果您正苦于以下问题:Python figureoptions.figure_edit方法的具体用法?Python figureoptions.figure_edit怎么用?Python figureoptions.figure_edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.qt_editor.figureoptions
的用法示例。
在下文中一共展示了figureoptions.figure_edit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_parameters
# 需要导入模块: from matplotlib.backends.qt_editor import figureoptions [as 别名]
# 或者: from matplotlib.backends.qt_editor.figureoptions import figure_edit [as 别名]
def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
if not allaxes:
QtWidgets.QMessageBox.warning(
self.parent, "Error", "There are no axes to edit.")
return
elif len(allaxes) == 1:
axes, = allaxes
else:
titles = []
for axes in allaxes:
name = (axes.get_title() or
" - ".join(filter(None, [axes.get_xlabel(),
axes.get_ylabel()])) or
"<anonymous {} (id: {:#x})>".format(
type(axes).__name__, id(axes)))
titles.append(name)
item, ok = QtWidgets.QInputDialog.getItem(
self.parent, 'Customize', 'Select axes:', titles, 0, False)
if ok:
axes = allaxes[titles.index(item)]
else:
return
figureoptions.figure_edit(axes, self)
示例2: edit_parameters
# 需要导入模块: from matplotlib.backends.qt_editor import figureoptions [as 别名]
# 或者: from matplotlib.backends.qt_editor.figureoptions import figure_edit [as 别名]
def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
if not allaxes:
QtWidgets.QMessageBox.warning(
self.parent, "Error", "There are no axes to edit.")
return
elif len(allaxes) == 1:
axes, = allaxes
else:
titles = []
for axes in allaxes:
name = (axes.get_title() or
" - ".join(filter(None, [axes.get_xlabel(),
axes.get_ylabel()])) or
"<anonymous {} (id: {:#x})>".format(
type(axes).__name__, id(axes)))
titles.append(name)
item, ok = QtWidgets.QInputDialog.getItem(
self.parent, 'Customize', 'Select axes:', titles, 0, False)
if ok:
axes = allaxes[titles.index(six.text_type(item))]
else:
return
figureoptions.figure_edit(axes, self)
示例3: edit_parameters
# 需要导入模块: from matplotlib.backends.qt_editor import figureoptions [as 别名]
# 或者: from matplotlib.backends.qt_editor.figureoptions import figure_edit [as 别名]
def edit_parameters(self):
axes = self.canvas.figure.get_axes()
if not axes:
QtWidgets.QMessageBox.warning(
self.parent, "Error", "There are no axes to edit.")
return
elif len(axes) == 1:
ax, = axes
else:
titles = [
ax.get_label() or
ax.get_title() or
" - ".join(filter(None, [ax.get_xlabel(), ax.get_ylabel()])) or
f"<anonymous {type(ax).__name__}>"
for ax in axes]
duplicate_titles = [
title for title in titles if titles.count(title) > 1]
for i, ax in enumerate(axes):
if titles[i] in duplicate_titles:
titles[i] += f" (id: {id(ax):#x})" # Deduplicate titles.
item, ok = QtWidgets.QInputDialog.getItem(
self.parent, 'Customize', 'Select axes:', titles, 0, False)
if not ok:
return
ax = axes[titles.index(item)]
figureoptions.figure_edit(ax, self)
示例4: edit_parameters
# 需要导入模块: from matplotlib.backends.qt_editor import figureoptions [as 别名]
# 或者: from matplotlib.backends.qt_editor.figureoptions import figure_edit [as 别名]
def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
if len(allaxes) == 1:
axes = allaxes[0]
else:
titles = []
for axes in allaxes:
title = axes.get_title()
ylabel = axes.get_ylabel()
label = axes.get_label()
if title:
fmt = "%(title)s"
if ylabel:
fmt += ": %(ylabel)s"
fmt += " (%(axes_repr)s)"
elif ylabel:
fmt = "%(axes_repr)s (%(ylabel)s)"
elif label:
fmt = "%(axes_repr)s (%(label)s)"
else:
fmt = "%(axes_repr)s"
titles.append(fmt % dict(title=title,
ylabel=ylabel, label=label,
axes_repr=repr(axes)))
item, ok = QtWidgets.QInputDialog.getItem(
self.parent, 'Customize', 'Select axes:', titles, 0, False)
if ok:
axes = allaxes[titles.index(six.text_type(item))]
else:
return
figureoptions.figure_edit(axes, self)