本文整理汇总了Python中matplotlib.backends.qt_editor.figureoptions.figure_edit函数的典型用法代码示例。如果您正苦于以下问题:Python figure_edit函数的具体用法?Python figure_edit怎么用?Python figure_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了figure_edit函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_parameters
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
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)
示例3: edit_parameters
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)
示例4: on_explore_clicked
def on_explore_clicked(self, bn):
# Adapted from matplotlib/backends/backend_qt5.py
allaxes = self.figure.get_axes()
if not allaxes:
QtGui.QMessageBox.warning(
None, "Error", "There are no axes to edit.")
return
if len(allaxes) == 1:
axes = allaxes[0]
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 = QtGui.QInputDialog.getItem(
None, 'Customize', 'Select axes:', titles, 0, False)
if ok:
axes = allaxes[titles.index(item)]
else:
return
figureoptions.figure_edit(axes, self)
self.update(False)