当前位置: 首页>>代码示例>>Python>>正文


Python NavigationToolbar2QT.edit_parameters方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_qt5agg.NavigationToolbar2QT.edit_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.edit_parameters方法的具体用法?Python NavigationToolbar2QT.edit_parameters怎么用?Python NavigationToolbar2QT.edit_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_qt5agg.NavigationToolbar2QT的用法示例。


在下文中一共展示了NavigationToolbar2QT.edit_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Widgetmain

# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import edit_parameters [as 别名]
class Widgetmain(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super(Widgetmain, self).__init__(parent)

        self.figure = Figure()

        # plt.subplots_adjust(left=0.031, right=0.999, top=0.99, bottom=0.03)
        # plt.subplots_adjust(left=0.001, right=0.999, top=0.999, bottom=0.001)

        self.canvas = FigureCanvas(self.figure)

        self.toolbar = NavigationToolbar(self.canvas, self)

        # uncomment for disabling plot toolbar, not recommended
        self.toolbar.hide()

        # set the layout
        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget(self.toolbar)
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        # set the plot class handlers
        self.wzoom = plot_tools.WheellZoom()
        self.adapt = plot_tools.WindowResize()  # keep tight layout
        self.cursor = plot_tools.SnaptoCursor()
        self.selector = plot_tools.Select()
        self.selection = plot_tools.Selection()
        self.dataplot = None

    def setStatus(self, stat):
        self.statusbar = stat

    def save_plot(self):
        self.toolbar.save_figure()

    def axis_configure(self):
        self.toolbar.edit_parameters()

    def plot(self, xaxis=None, real=None, imag=None, magn=None, hxlimit=None, lxlimit=None, datas=None):

        # self.dataplot.clear()
        # if self.dataplot:
        # self.figure.delaxes(self.dataplot)
        if self.dataplot is None:
            self.dataplot = self.figure.add_subplot(111)
            self.figure.patch.set_facecolor("white")
            self.selector.setAx(self.dataplot, hxlimit, lxlimit, xaxis.size, datas, self.selection)

        # self.dataplot = self.figure.add_subplot(111)
        # self.selector.setAx(self.dataplot, hxlimit, lxlimit, xaxis.size, datas, self.selection)
        self.statusbar.showMessage("Plot updated")
        self.dataplot.hold(False)
        self.dataplot.plot(xaxis, real, "r-", xaxis, imag, "g-", xaxis, magn, "-")

        # uncomment for matlibplot standard cursor
        # cursor = Cursor(dataplot, useblit=True, color='black', linewidth=1 )

        self.wzoom.setAx(self.dataplot, self.selection, datas)
        self.cursor.setAx(datas, self.dataplot, xaxis, real, self.statusbar)
        self.adapt.setAx(self.dataplot, self.figure)
        self.selection.setAx(self.dataplot, datas)

        self.figure.tight_layout()

        # dataplot.set_autoscaley_on(False) for auto x scale

        # setting background color
        # self.figure.patch.set_visible(False)
        # self.figure.patch.set_facecolor('white')

        self.dataplot.set_xlim([lxlimit, hxlimit])

        # uncomment the following line for raw axis label inside plot
        # self.dataplot.tick_params(direction='in', pad=-19)

        # uncomment the following lines to disable plot toolbar mouse coordinates
        # def format_coord(x, y):
        #    return ' '
        # self.dataplot.format_coord = format_coord

        self.canvas.draw()
开发者ID:Pymatteo,项目名称:QtNMR,代码行数:84,代码来源:graphics.py


注:本文中的matplotlib.backends.backend_qt5agg.NavigationToolbar2QT.edit_parameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。