本文整理汇总了Python中matplotlib.backends.backend_qt4.NavigationToolbar2QT.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.addAction方法的具体用法?Python NavigationToolbar2QT.addAction怎么用?Python NavigationToolbar2QT.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.addAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.plot_layout.addWidget(self.line_width, 2,1)
self.plot_layout.addWidget(self.line_colour_lbl, 3,0)
self.plot_layout.addWidget(self.line_colour,3,1)
self.plot_layout.addWidget(self.marker_style_lbl, 1,2)
self.plot_layout.addWidget(self.marker_style, 1,3)
self.plot_layout.addWidget(self.marker_colour_lbl, 2,2)
self.plot_layout.addWidget(self.marker_colour, 2,3)
#Stats Properties
self.Grid_horizontal_Layout_2.addWidget(self.stats_box, 1)
string = '<span style=" font-size:12pt;; font-weight:600;">Stats Settings</span>'
self.stats_layout_text = QtGui.QLabel(string, self)
self.mean_output_lbl = QtGui.QLabel("Data Mean")
self.mean_output = QtGui.QLineEdit(self)
self.median_output_lbl = QtGui.QLabel("Data Median")
self.median_output = QtGui.QLineEdit(self)
self.sd_lbl = QtGui.QLabel("Std Deviation")
self.sd_output = QtGui.QLineEdit(self)
self.stats_buttons = QtGui.QButtonGroup()
self.poly_label = QtGui.QLabel('Poly Fit')
#self.poly_fit = QtGui.QRadioButton('Poly Fit', self)
self.poly_order_text = QtGui.QLabel('Order', self)
self.poly_order = QtGui.QSpinBox(self)
self.poly_order.setRange(1, 10)
self.poly_plot_button = QtGui.QPushButton('Plot', self)
self.stats_buttons.addButton(self.poly_plot_button)
self.poly_plot_button.clicked.connect(self.polyfit)
self.rolling_mean_radio = QtGui.QRadioButton('Rolling Mean', self)
self.rolling_median_radio = QtGui.QRadioButton('Rolling Median', self)
self.moving_avg_window_text = QtGui.QLabel('Window')
self.moving_avg_window = QtGui.QSpinBox(self)
self.moving_avg_window.setRange(1,1000)
self.moving_avg_plot = QtGui.QPushButton('Plot', self)
self.moving_avg_plot.clicked.connect(self.moving_average_buttons)
self.trendline_lbl = QtGui.QLabel("Trendline Equation")
self.trendline_equation = QtGui.QLineEdit(self)
self.r_squared_lbl = QtGui.QLabel("R Squared")
self.r_squared_output = QtGui.QLineEdit(self)
self.stats_layout.addWidget(self.stats_layout_text, 0,0,1,4)
self.stats_layout.addWidget(self.mean_output_lbl, 1,0)
self.stats_layout.addWidget(self.mean_output, 1,1)
self.stats_layout.addWidget(self.median_output_lbl, 1,2)
self.stats_layout.addWidget(self.median_output, 1,3)
self.stats_layout.addWidget(self.sd_lbl, 1,4)
self.stats_layout.addWidget(self.sd_output, 1,5)
self.stats_layout.addWidget(self.poly_label, 2,0)
self.stats_layout.addWidget(self.poly_order_text, 2,1)
self.stats_layout.addWidget(self.poly_order, 2,2)
self.stats_layout.addWidget(self.poly_plot_button,2,3)
self.stats_layout.addWidget(self.rolling_mean_radio, 3,0)
self.stats_layout.addWidget(self.rolling_median_radio, 3,1)
self.stats_layout.addWidget(self.moving_avg_window_text,3,2)
self.stats_layout.addWidget(self.moving_avg_window, 3,3)
self.stats_layout.addWidget(self.moving_avg_plot, 3,4)
self.stats_layout.addWidget(self.trendline_lbl, 5,0)
self.stats_layout.addWidget(self.trendline_equation, 5,1)
self.stats_layout.addWidget(self.r_squared_lbl, 5,2)
self.stats_layout.addWidget(self.r_squared_output, 5,3)'''
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
#self.xlabel = QtGui.QInputDialog.getText(self, 'X-axis Label')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.button_grid()
示例2: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.pos_label = QtGui.QLabel('Pos Value', self)
self.pos_val = QtGui.QDoubleSpinBox(self)
self.pos_val.setRange(-100, 100)
self.pos_val.setValue(2)
self.TravL_label = QtGui.QLabel('Trav Length', self)
self.TravL_val = QtGui.QDoubleSpinBox(self)
self.TravL_val.setRange(0, 1000)
self.TravL_val.setValue(30)
self.TravI_label = QtGui.QLabel('Sample Interval', self)
self.TravI_val = QtGui.QDoubleSpinBox(self)
self.TravI_val.setValue(0.25)
self.GridL_label = QtGui.QLabel('Grid Width', self)
self.GridL_val = QtGui.QDoubleSpinBox(self)
self.GridL_val.setRange(0, 1000)
self.GridL_val.setValue(30)
self.GridI_label = QtGui.QLabel('Traverse Interval', self)
self.GridI_val = QtGui.QDoubleSpinBox(self)
self.GridI_val.setValue(1)
self.Grid_horizontal_Layout_1.addWidget(self.TravL_label)
self.Grid_horizontal_Layout_1.addWidget(self.TravL_val)
self.Grid_horizontal_Layout_1.addWidget(self.TravI_label)
self.Grid_horizontal_Layout_1.addWidget(self.TravI_val)
self.Grid_horizontal_Layout_2.addWidget(self.GridL_label)
self.Grid_horizontal_Layout_2.addWidget(self.GridL_val)
self.Grid_horizontal_Layout_2.addWidget(self.GridI_label)
self.Grid_horizontal_Layout_2.addWidget(self.GridI_val)
self.Grid_horizontal_Layout_3 = QtGui.QHBoxLayout()
self.Grid_horizontal_Layout_3.setObjectName("Grid_horizontal_Layout_3")
self.Options_Grid.addLayout(self.Grid_horizontal_Layout_3, 2, 0, 1, 1)
self.Grid_horizontal_Layout_3.addWidget(self.neg_label)
self.Grid_horizontal_Layout_3.addWidget(self.neg_val)
self.Grid_horizontal_Layout_3.addWidget(self.pos_label)
self.Grid_horizontal_Layout_3.addWidget(self.pos_val)
def Button_Definitions(self):
self.firstrun=True
self.Open_button = QtGui.QPushButton('Open', self)
self.fname = self.Open_button.clicked.connect(self.Open_Geoplot)
self.Button_Layout.addWidget(self.Open_button)
self.pushButton_plot.clicked.connect(self.Plot_Function)
self.pushButton_clear.clicked.connect(self.ClearPlot)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"),self, self.Plot_Function)
self.Save_button = QtGui.QPushButton('Save as .txt',self)
self.Save_button.clicked.connect(self.save_as_txt)
self.Button_Layout.addWidget(self.Save_button)
self.pushButton = QtGui.QPushButton('Median Filter',self)
self.pushButton.clicked.connect(self.Plot_Median_Filter)
self.pushButton_clear.clicked.connect(self.ClearPlot)
#QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"),self, self.Plot_Function)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
def save_as_txt(self):
self.txt_name = QtGui.QFileDialog.getSaveFileName(self)
np.savetxt(self.txt_name + '.txt', self.output)
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.Button_Definitions()
self.plot_options()
示例3: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.buttons = QtGui.QButtonGroup()
self.open_button = QtGui.QPushButton('Open', self)
self.buttons.addButton(self.open_button)
self.open_button.clicked.connect(self.Open_File)
self.regrid_button = QtGui.QPushButton('Regrid', self)
self.buttons.addButton(self.regrid_button)
self.regrid_button.clicked.connect(self.regrid)
self.clear_button = QtGui.QPushButton('Clear', self)
self.buttons.addButton(self.clear_button)
self.clear_button.clicked.connect(self.ClearPlot)
self.chart_title = QtGui.QLineEdit(self)
self.config_lbl = QtGui.QLabel('Orientation', self)
self.hcp_config = QtGui.QRadioButton('HCP', self)
self.vcp_config = QtGui.QRadioButton('VCP', self)
self.grid = QtGui.QLineEdit(self)
self.grid.setText('Enter Grid Number')
self.buttons_layout.addWidget(self.buttons_layout_text, 0,0,1,4)
self.buttons_layout.addWidget(self.open_button, 1,0)
self.buttons_layout.addWidget(self.regrid_button, 2,0)
self.buttons_layout.addWidget(self.clear_button, 3,0)
self.buttons_layout.addWidget(self.chart_title, 4,0)
self.buttons_layout.addWidget(self.config_lbl, 1,1)
self.buttons_layout.addWidget(self.hcp_config, 2,1)
self.buttons_layout.addWidget(self.vcp_config, 3,1)
self.buttons_layout.addWidget(self.grid, 4,1)
#survey parameters
self.Grid_horizontal_Layout_2.addWidget(self.survey_box, 1)
string = '<span style=" font-size:10pt;; font-weight:600;">Survey Parameters</span>'
self.survey_layout_text = QtGui.QLabel(string, self)
self.survey_buttons = QtGui.QButtonGroup()
self.samples_start_lbl = QtGui.QLabel('Samples Start Position')
self.samples_start = QtGui.QLineEdit(self)
self.samples_stop_lbl = QtGui.QLabel('Samples End Position')
self.samples_stop = QtGui.QLineEdit(self)
self.samples_int_lbl = QtGui.QLabel('Sampling Interval')
self.samples_int = QtGui.QLineEdit(self)
self.trav_start_lbl = QtGui.QLabel('Traverses Start Position')
self.trav_start = QtGui.QLineEdit(self)
self.trav_stop_lbl = QtGui.QLabel('Traverses End Position')
self.trav_stop = QtGui.QLineEdit(self)
self.trav_int_lbl = QtGui.QLabel('Traverse Interval')
self.trav_int = QtGui.QLineEdit(self)
self.survey_layout.addWidget(self.survey_layout_text, 0,0,1,2)
self.survey_layout.addWidget(self.samples_start_lbl, 1,0)
self.survey_layout.addWidget(self.samples_start, 1,1)
self.survey_layout.addWidget(self.samples_stop_lbl, 2,0)
self.survey_layout.addWidget(self.samples_stop, 2,1)
self.survey_layout.addWidget(self.samples_int_lbl, 3,0)
self.survey_layout.addWidget(self.samples_int,3,1)
self.survey_layout.addWidget(self.trav_start_lbl, 4,0)
self.survey_layout.addWidget(self.trav_start, 4,1)
self.survey_layout.addWidget(self.trav_stop_lbl, 5,0)
self.survey_layout.addWidget(self.trav_stop, 5,1)
self.survey_layout.addWidget(self.trav_int_lbl, 6,0)
self.survey_layout.addWidget(self.trav_int, 6,1)
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
#self.xlabel = QtGui.QInputDialog.getText(self, 'X-axis Label')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.button_grid()
示例4: TraverseMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
# self.bottom_fname = self.bottom_open_button.clicked.connect(self.Open_File)
self.bottom_plot_buttons.addButton(self.bottom_plot_button)
self.bottom_clear_button = QtGui.QPushButton("Clear", self)
# self.bottom_fname = self.bottom_open_button.clicked.connect(self.Open_File)
self.bottom_plot_buttons.addButton(self.bottom_clear_button)
self.bottom_plot_input = QtGui.QButtonGroup()
self.bottom_units = QtGui.QPushButton("Input Units", self)
self.bottom_units.clicked.connect(self.openInputDialog)
# Defines combo boxes for bottom plot
self.bottom_plot_combo = QtGui.QButtonGroup()
self.bottom_xcombo = QtGui.QComboBox()
self.bottom_xcombo.addItems("X")
self.bottom_xcombo_lbl = QtGui.QLabel("X Values", self)
self.bottom_ycombo = QtGui.QComboBox()
self.bottom_ycombo.addItems("Y")
self.bottom_ycombo_lbl = QtGui.QLabel("Y Values", self)
self.bottom_plot_layout.addWidget(self.bottom_plot_layout_text, 0, 0, 1, 4)
self.bottom_plot_layout.addWidget(self.bottom_open_button, 1, 0)
self.bottom_plot_layout.addWidget(self.bottom_plot_button, 2, 0)
self.bottom_plot_layout.addWidget(self.bottom_clear_button, 3, 0)
self.bottom_plot_layout.addWidget(self.bottom_units, 4, 0)
self.bottom_plot_layout.addWidget(self.bottom_xcombo_lbl, 1, 1)
self.bottom_plot_layout.addWidget(self.bottom_xcombo, 2, 1)
self.bottom_plot_layout.addWidget(self.bottom_ycombo_lbl, 3, 1)
self.bottom_plot_layout.addWidget(self.bottom_ycombo, 4, 1)
def Plot_Function(self):
"""
Clears Matplotlib Widget Canvas
Adds 3 subplots
plots Difference Data
sharex - shares x axis between subplots
"""
# self.legend.remove()
# Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
# Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("home.png"), "Home", self.navi_toolbar.home)
# a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("move.png"), "Pan", self.navi_toolbar.pan)
a.setToolTip("Pan axes with left mouse, zoom with right")
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("zoom_to_rect.png"), "Zoom", self.navi_toolbar.zoom)
a.setToolTip("Zoom to Rectangle")
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("filesave.png"), "Save", self.navi_toolbar.save_figure)
a.setToolTip("Save the figure")
self.toolbar_grid.addWidget(self.navi_toolbar)
self.top_xval = self.top_data[self.top_data.dtype.names[self.top_xcombo.currentIndex()]]
self.top_yval = self.top_data[self.top_data.dtype.names[self.top_ycombo.currentIndex()]]
self.yval = self.yval - np.median(self.yval)
x1 = np.linspace(0.0, 5.0)
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
y2 = np.cos(3 * np.pi * x1) * np.exp(-x1)
y3 = np.cos(4 * np.pi * x1) * np.exp(-x1)
self.mpl.canvas.fig.clear()
self.plot1 = self.mpl.canvas.fig.add_subplot(3, 1, 1)
# self.plot1.plot(self.top_xval,self.top_yval)
self.plot2 = self.mpl.canvas.fig.add_subplot(3, 1, 2, sharex=self.plot1)
self.plot2.plot(x1, y2)
self.plot3 = self.mpl.canvas.fig.add_subplot(3, 1, 3, sharex=self.plot1)
self.plot3.plot(x1, y3)
def keyboard_Definitions(self):
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"), self, self.Plot_Function)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"), self, self.copy_to_clipboard)
def menubar_definitions(self):
self.fname = self.Open_button.clicked.connect(self.Open_File)
def __init__(self, parent=None):
# initialization of the superclass
super(TraverseMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
# Button_layout is a QT desginer Grid Layout.
self.keyboard_Definitions()
# self.Plot_Function()
self.button_grid()
self.statusbar.setEnabled(True)
self.statusbar.showMessage("Ready")
示例5: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.GridL_val.setValue(30)
self.GridI_label = QtGui.QLabel('Traverse Interval', self)
self.GridI_val = QtGui.QDoubleSpinBox(self)
self.GridI_val.setValue(1)
self.Scale_label = QtGui.QLabel('Scale Value', self)
self.Scale_val =QtGui.QDoubleSpinBox(self)
self.Scale_val.setRange(1, 5000)
self.Scale_val.setValue(500)
self.Clip_label = QtGui.QLabel('Clipping Value', self)
self.Clip_val = QtGui.QDoubleSpinBox(self)
self.Clip_val.setRange(0.1, 100)
self.Clip_val.setValue(15)
self.Grid_horizontal_Layout_1.addWidget(self.TravL_label)
self.Grid_horizontal_Layout_1.addWidget(self.TravL_val)
self.Grid_horizontal_Layout_1.addWidget(self.TravI_label)
self.Grid_horizontal_Layout_1.addWidget(self.TravI_val)
self.Grid_horizontal_Layout_2.addWidget(self.GridL_label)
self.Grid_horizontal_Layout_2.addWidget(self.GridL_val)
self.Grid_horizontal_Layout_2.addWidget(self.GridI_label)
self.Grid_horizontal_Layout_2.addWidget(self.GridI_val)
self.Grid_horizontal_Layout_3 = QtGui.QHBoxLayout()
self.Grid_horizontal_Layout_3.setObjectName("Grid_horizontal_Layout_3")
self.Options_Grid.addLayout(self.Grid_horizontal_Layout_3, 2, 0, 1, 1)
self.Grid_horizontal_Layout_3.addWidget(self.neg_label)
self.Grid_horizontal_Layout_3.addWidget(self.neg_val)
self.Grid_horizontal_Layout_3.addWidget(self.pos_label)
self.Grid_horizontal_Layout_3.addWidget(self.pos_val)
self.Grid_horizontal_Layout_4 = QtGui.QHBoxLayout()
self.Grid_horizontal_Layout_4.setObjectName("Grid_horizontal_Layout_4")
self.Options_Grid.addLayout(self.Grid_horizontal_Layout_4, 3, 0, 1, 1)
self.Grid_horizontal_Layout_4.addWidget(self.Scale_label)
self.Grid_horizontal_Layout_4.addWidget(self.Scale_val)
self.Grid_horizontal_Layout_4.addWidget(self.Clip_label)
self.Grid_horizontal_Layout_4.addWidget(self.Clip_val)
def Button_Definitions(self):
self.firstrun=True
self.Open_button = QtGui.QPushButton('Open', self)
self.fname = self.Open_button.clicked.connect(self.Open_Geoplot)
self.Button_Layout.addWidget(self.Open_button)
self.Save_button = QtGui.QPushButton('Save as DXF',self)
self.Save_button.clicked.connect(self.dxf_save_button)
self.Button_Layout.addWidget(self.Save_button)
self.pushButton_plot.clicked.connect(self.Plot_Function)
self.pushButton_clear.clicked.connect(self.ClearPlot)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"),self, self.Plot_Function)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
def dxf_save_button(self):
self.dxf_name = QtGui.QFileDialog.getSaveFileName(self)
self.Scale = self.Scale_val.value()
self.Clip = self.Clip_val.value()
QtGui.QMessageBox.about(self, "This May take a second", "Saving DXF's can be slow, please be paient. \n A dialogue will open when finished")
comp2dxf(self.output,self.dxf_name,self.sample_interval,self.traverse_interval,self.Scale,self.Clip, 'CMP2DXF')
QtGui.QMessageBox.about(self, "Thanks for waiting", "Sorry about the wait, DXFengine is slow. \n The DXF has been saved. ")
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.Button_Definitions()
self.plot_options()
示例6: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.savgol_order.setValue(2)
self.savgol_plot = QtGui.QPushButton("Plot", self)
self.savgol_plot.clicked.connect(self.savgol_filter)
self.trendline_lbl = QtGui.QLabel("Trendline Equation")
self.trendline_equation = QtGui.QLineEdit(self)
self.r_squared_lbl = QtGui.QLabel("R Squared")
self.r_squared_output = QtGui.QLineEdit(self)
self.curvefit_layout.addWidget(self.curvefit_layout_text, 0, 0, 1, 4)
self.curvefit_layout.addWidget(self.poly_label, 1, 0)
self.curvefit_layout.addWidget(self.data_trend, 1, 1)
self.curvefit_layout.addWidget(self.savgol_trend, 1, 2)
self.curvefit_layout.addWidget(self.poly_order_text, 1, 3)
self.curvefit_layout.addWidget(self.poly_order, 1, 4)
self.curvefit_layout.addWidget(self.poly_plot_button, 1, 5)
self.curvefit_layout.addWidget(self.rolling_mean_radio, 2, 0)
self.curvefit_layout.addWidget(self.rolling_median_radio, 2, 1)
self.curvefit_layout.addWidget(self.moving_avg_window_text, 2, 2)
self.curvefit_layout.addWidget(self.moving_avg_window, 2, 3)
self.curvefit_layout.addWidget(self.moving_avg_plot, 2, 4)
self.curvefit_layout.addWidget(self.savgol_lbl, 3, 0)
self.curvefit_layout.addWidget(self.savgol_window_lbl, 3, 1)
self.curvefit_layout.addWidget(self.savgol_window, 3, 2)
self.curvefit_layout.addWidget(self.savgol_order_lbl, 3, 3)
self.curvefit_layout.addWidget(self.savgol_order, 3, 4)
self.curvefit_layout.addWidget(self.savgol_plot, 3, 5)
self.curvefit_layout.addWidget(self.trendline_lbl, 4, 0)
self.curvefit_layout.addWidget(self.trendline_equation, 4, 1)
self.curvefit_layout.addWidget(self.r_squared_lbl, 4, 2)
self.curvefit_layout.addWidget(self.r_squared_output, 4, 3)
# Stats Properties
self.Grid_horizontal_Layout_2.addWidget(self.stats_box, 1)
string = '<span style=" font-size:10pt;; font-weight:600;">Stats</span>'
self.stats_layout_text = QtGui.QLabel(string, self)
self.min_output_lbl = QtGui.QLabel("Data Min:")
self.min_output = QtGui.QLineEdit(self)
self.max_output_lbl = QtGui.QLabel("Data Max:")
self.max_output = QtGui.QLineEdit(self)
self.mean_output_lbl = QtGui.QLabel("Data Mean:")
self.mean_output = QtGui.QLineEdit(self)
self.median_output_lbl = QtGui.QLabel("Data Median:")
self.median_output = QtGui.QLineEdit(self)
self.sd_lbl = QtGui.QLabel("Std Deviation:")
self.sd_output = QtGui.QLineEdit(self)
self.bins_lbl = QtGui.QLabel("Histogram Bins:")
self.bins = QtGui.QSpinBox(self)
self.bins.setRange(1, 1000)
self.bins.setValue(50)
self.histogram = QtGui.QPushButton("Plot", self)
self.histogram.clicked.connect(self.plot_histogram)
self.stats_layout.addWidget(self.stats_layout_text, 0, 0, 1, 4)
self.stats_layout.addWidget(self.min_output_lbl, 1, 0)
self.stats_layout.addWidget(self.min_output, 1, 1)
self.stats_layout.addWidget(self.max_output_lbl, 2, 0)
self.stats_layout.addWidget(self.max_output, 2, 1)
self.stats_layout.addWidget(self.mean_output_lbl, 3, 0)
self.stats_layout.addWidget(self.mean_output, 3, 1)
self.stats_layout.addWidget(self.median_output_lbl, 4, 0)
self.stats_layout.addWidget(self.median_output, 4, 1)
self.stats_layout.addWidget(self.sd_lbl, 5, 0)
self.stats_layout.addWidget(self.sd_output, 5, 1)
self.stats_layout.addWidget(self.bins_lbl, 6, 0)
self.stats_layout.addWidget(self.bins, 6, 1)
self.stats_layout.addWidget(self.histogram, 6, 2)
def __init__(self, parent=None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
# Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
# Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("home.png"), "Home", self.navi_toolbar.home)
# a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("move.png"), "Pan", self.navi_toolbar.pan)
a.setToolTip("Pan axes with left mouse, zoom with right")
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("zoom_to_rect.png"), "Zoom", self.navi_toolbar.zoom)
a.setToolTip("Zoom to Rectangle")
a = self.navi_toolbar.addAction(self.navi_toolbar._icon("filesave.png"), "Save", self.navi_toolbar.save_figure)
a.setToolTip("Save the figure")
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"), self, self.copy_to_clipboard)
# self.xlabel = QtGui.QInputDialog.getText(self, 'X-axis Label')
# Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.button_grid()
示例7: ModellerMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
def plot_2d(self):
self.mpl.canvas.ax.plot(self.x,self.y)
self.mpl.canvas.ax.axis('auto')
#self.mpl.canvas.ax.set_xlim(xmin=np.min(self.x), xmax=(np.max(self.x)))
self.mpl.canvas.ax.set_ylim(ymin=np.min(self.y), ymax=(np.max(self.y)))
self.mpl.canvas.ax.set_autoscale_on(True)
self.mpl.canvas.ax.autoscale_view(True,True,True)
self.mpl.canvas.ax.set_xlabel(self.xtitle, size = 15)
self.mpl.canvas.ax.set_ylabel(self.ytitle, size = 15)
self.mpl.canvas.ax.set_title(self.title, size = 15)
self.mpl.canvas.draw()
def plot_2dpseudo(self):
self.ClearPlot()
temp = np.flipud(self.output)
self.mpl.canvas.ax.imshow(temp, interpolation='none', cmap=plt.cm.Greys,aspect='auto',origin='upper')
self.mpl.canvas.ax.set_xlabel(self.xtitle, size = 15)
self.mpl.canvas.ax.set_ylabel(self.ytitle, size = 15)
self.mpl.canvas.ax.set_title(self.title, size = 15)
self.cb = plt.colorbar(self.mpl.canvas.ax.imshow(self.output,cmap=plt.cm.Greys), ticks=self.arrayrange)
#self.mpl.canvas.colorbar(self.mpl.canvas.ax.imshow(self.output,cmap=plt.cm.Greys), ticks=self.arrayrange)
self.mpl.canvas.draw()
def Button_Definitions(self):
self.firstrun=True
QtCore.QObject.connect(self.radioButton_mag, QtCore.SIGNAL("toggled(bool)"), self.MagRes2D3Dtoggle)
QtCore.QObject.connect(self.radioButton_2d, QtCore.SIGNAL("toggled(bool)"), self.MagRes2D3Dtoggle)
self.pushButton_plot.clicked.connect(self.CalculateFields)
self.pushButton_clear.clicked.connect(self.ClearPlot)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"),self, self.CalculateFields)
self.action_Save_Data.triggered.connect(self.save_csv)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"),self, self.save_csv)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
# Buttons in Toolbar
#self.push_put_data.clicked.connect(self.put_cloud_data)
#self.push_load_field.clicked.connect(self.load_field)
#self.Push_cor_GNSS.clicked.connect(self.load_cloud_points)
#self.Push_cor_GNSS.clicked.connect(self.Process_GNSS)
#self.Push_display_barty_points.clicked.connect(self.calculate_barty_locs)
# self.Push_Desample.clicked.connect(self.remove_collinears)
# self.Push_Greyscale.clicked.connect(self.Grid_Data)
# self.Push_ZMT.clicked.connect(self.ZMT)
# self.Push_Calibrate.clicked.connect(self.calibrate)
# self.Push_Despike.clicked.connect(self.Despike)
# self.Push_Export.clicked.connect(self.import_NMEA)
# Buttons in Menu
# self.actionOpen_File.triggered.connect(self.data_SourceFile)
# self.actionDisplay_GreyScale.triggered.connect(self.Grid_Data)
#QtCore.QObject.connect(self.mplactionQuit, QtCore.SIGNAL('triggered()'), QtGui.qApp, QtCore.SLOT("quit()"))
def __init__(self, parent = None):
# initialization of the superclass
super(ModellerMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
#self.navi_toolbar.clear()
# Add the x,y location widget at the right side of the toolbar
# The stretch factor is 1 which means any resizing of the toolbar
# will resize this label instead of the buttons.
# self.navi_toolbar.locLabel = QtGui.QLabel( "", self )
# self.navi_toolbar.locLabel.setAlignment(QtCore.Qt.AlignLeft)
# self.navi_toolbar.locLabel.setSizePolicy(
# QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
# QtGui.QSizePolicy.Expanding))
# labelAction = self.navi_toolbar.addWidget(self.navi_toolbar.locLabel)
# labelAction.setVisible(True)
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.Button_Definitions()
#Run Radio Toggle Code to grey / allow relevant options
self.radioButton_2d.click()
self.radioButton_res.click()
self.MagRes2D3Dtoggle()
示例8: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
class ArchaeoPYMainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""Customization for Qt Designer created window"""
def ClearPlot(self):
self.mpl.canvas.ax.clear()
self.mpl.canvas.draw()
def copy_to_clipboard(self):
pixmap = QtGui.QPixmap.grabWidget(self.mpl.canvas)
QtGui.QApplication.clipboard().setPixmap(pixmap)
def Open_File(self):
self.fname = QtGui.QFileDialog.getOpenFileName()
self.Image2Float()
def Image2Float(self):
self.f = open(self.fname, 'rb')
self.image = io.imread(self.f)
self.array = img_as_float(self.image)
def Plot_Original_Image(self):
self.mpl.canvas.ax.clear()
self.mpl.canvas.ax.imshow(self.image)
self.mpl.canvas.draw()
def Plot_Function(self):
self.output = cannyfilter(self.array) #Updated to imported module as necessary
self.mpl.canvas.ax.clear()
self.mpl.canvas.ax.imshow(self.output, cmap=plt.cm.gray)
self.mpl.canvas.draw()
def Button_Definitions(self):
self.firstrun=True
self.Open_button = QtGui.QPushButton('Open', self)
self.fname = self.Open_button.clicked.connect(self.Open_File)
self.fname = self.Open_button.clicked.connect(self.Plot_Original_Image)
self.Button_Layout.addWidget(self.Open_button)
self.pushButton_plot.clicked.connect(self.Plot_Function)
self.pushButton_clear.clicked.connect(self.ClearPlot)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+P"),self, self.Plot_Function)
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.Button_Definitions()
示例9: ArchaeoPYMainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4 import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4.NavigationToolbar2QT import addAction [as 别名]
#.........这里部分代码省略.........
self.stats_box.setLayout(self.stats_layout)
self.plot_layout = QtGui.QGridLayout()
self.plot_box = QtGui.QGroupBox()
self.plot_box.setLayout(self.plot_layout)
#File Properties
self.Grid_horizontal_Layout_2.addWidget(self.buttons_box, 1)
string = '<span style=" font-size:12pt;; font-weight:600;">File Settings</span>'
self.buttons_layout_text = QtGui.QLabel(string, self)
self.buttons = QtGui.QButtonGroup()
self.open_button = QtGui.QPushButton('Open', self)
self.buttons.addButton(self.open_button)
self.open_button.clicked.connect(self.Open_File)
self.grid_button = QtGui.QPushButton('Grid', self)
self.buttons.addButton(self.grid_button)
self.grid_button.clicked.connect(self.grid_data)
self.clear_button = QtGui.QPushButton('Clear', self)
self.buttons.addButton(self.clear_button)
self.clear_button.clicked.connect(self.ClearPlot)
self.chart_title = QtGui.QLineEdit(self)
self.chart_title.setText("Enter Chart Title")
self.xy_units = QtGui.QLineEdit(self)
self.xy_units.setText("X/Y Units")
self.z_units = QtGui.QLineEdit(self)
self.z_units.setText("Z Units")
self.xcombo = QtGui.QComboBox()
self.xcombo.addItems('X')
self.x_lbl = QtGui.QLabel('X Values --')
self.ycombo = QtGui.QComboBox()
self.ycombo.addItems('Y')
self.y_lbl = QtGui.QLabel('Y values --')
self.zcombo = QtGui.QComboBox()
self.zcombo.addItems('Z')
self.z_lbl = QtGui.QLabel('Z values --')
self.xint_lbl = QtGui.QLabel('X Interval')
self.xint_box = QtGui.QLineEdit()
self.yint_lbl = QtGui.QLabel('Y Interval')
self.yint_box = QtGui.QLineEdit()
self.buttons_layout.addWidget(self.buttons_layout_text, 0,0,1,4)
self.buttons_layout.addWidget(self.open_button, 1,0)
self.buttons_layout.addWidget(self.grid_button, 2,0)
self.buttons_layout.addWidget(self.clear_button, 3,0)
self.buttons_layout.addWidget(self.chart_title, 4,0)
self.buttons_layout.addWidget(self.xy_units, 5,0)
self.buttons_layout.addWidget(self.z_units, 6,0)
self.buttons_layout.addWidget(self.x_lbl, 1,1)
self.buttons_layout.addWidget(self.xcombo, 2,1)
self.buttons_layout.addWidget(self.y_lbl, 3,1)
self.buttons_layout.addWidget(self.ycombo, 4,1)
self.buttons_layout.addWidget(self.z_lbl, 5,1)
self.buttons_layout.addWidget(self.zcombo, 6,1)
self.buttons_layout.addWidget(self.xint_lbl, 1,2)
self.buttons_layout.addWidget(self.xint_box, 2,2)
self.buttons_layout.addWidget(self.yint_lbl, 3,2)
self.buttons_layout.addWidget(self.yint_box, 4,2)
def __init__(self, parent = None):
# initialization of the superclass
super(ArchaeoPYMainWindow, self).__init__(parent)
# setup the GUI --> function generated by pyuic4
self.setupUi(self)
#Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
self.navi_toolbar.clear()
#Adds Buttons
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
self.navi_toolbar.home)
#a.setToolTip('returns axes to original position')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
self.navi_toolbar.pan)
a.setToolTip('Pan axes with left mouse, zoom with right')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
self.navi_toolbar.zoom)
a.setToolTip('Zoom to Rectangle')
a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
self.navi_toolbar.save_figure)
a.setToolTip('Save the figure')
QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"),self, self.copy_to_clipboard)
#self.xlabel = QtGui.QInputDialog.getText(self, 'X-axis Label')
#Button_layout is a QT desginer Grid Layout.
self.toolbar_grid.addWidget(self.navi_toolbar)
self.button_grid()