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


Python QtBlissGraph.setx1axislimits方法代码示例

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


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

示例1: PymcaPlotWidget

# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setx1axislimits [as 别名]
class PymcaPlotWidget(QWidget):
    """
    Descript. :
    """

    def __init__(self, parent, realtime_plot = False):
        """
        Descript. :
        """
        QWidget.__init__(self, parent)

        self.axis_x_array = []
        self.axis_y_array = []

        self.realtime_plot = realtime_plot
   
        self.pymca_graph = Graph(self)
        self.pymca_graph.showGrid()
        self.info_label = QLabel("", self)  
        self.info_label.setAlignment(Qt.AlignRight)

        _main_vlayout = QVBoxLayout(self)
        _main_vlayout.addWidget(self.pymca_graph)  
        _main_vlayout.addWidget(self.info_label)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.setSizePolicy(QSizePolicy.Expanding,
                           QSizePolicy.Expanding)

        if qt_variant == 'PyQt5':
             pass
        else:
             QObject.connect(self.pymca_graph,
                             SIGNAL("QtBlissGraphSignal"),
                             self.handle_graph_signal)

        Qt4_widget_colors.set_widget_color(self, Qt4_widget_colors.WHITE)         

    def clear(self):
        """
        Descript. :
        """
        self.pymca_graph.clearcurves()
        self.pymca_graph.setTitle("")
        self.info_label.setText("")

    def plot_energy_scan_curve(self, scan_result, scan_title):
        """Results are converted to two list describing
           x and y axes
        """
        x_data = [item[0] for item in scan_result]
        y_data = [item[1] for item in scan_result] 
        self.pymca_graph.newcurve("Energy", x_data, y_data)
        self.pymca_graph.replot()
        self.pymca_graph.setTitle(scan_title)
        self.pymca_graph.setx1axislimits(min(x_data), max(x_data))

    def start_new_scan(self, scan_info):
        """
        Descript. :
        """
        self.axis_x_array = []
        self.axis_y_array = []
        self.pymca_graph.clearcurves()
        self.pymca_graph.xlabel(scan_info['xlabel'])
        self.ylabel = scan_info['ylabel']
        self.pymca_graph.ylabel(self.ylabel)
        self.pymca_graph.setx1timescale(False)
        self.pymca_graph.replot()
        self.pymca_graph.setTitle(scan_info['title'])

    def plot_energy_scan_results(self, pk, fppPeak, fpPeak, ip, fppInfl, 
            fpInfl, rm, chooch_graph_x, chooch_graph_y1, chooch_graph_y2, title):
        """
        """
        self.pymca_graph.clearcurves()
        self.pymca_graph.setTitle(title)
        self.pymca_graph.newcurve("spline", chooch_graph_x, chooch_graph_y1)
        self.pymca_graph.newcurve("fp", chooch_graph_x, chooch_graph_y2)
        self.pymca_graph.replot()
        self.pymca_graph.setx1axislimits(min(chooch_graph_x),
                                         max(chooch_graph_x))
 
    def plot_finished(self):
        """
        Descript. :
        """
        if self.axis_x_array:
            self.pymca_graph.setx1axislimits(min(self.axis_x_array),
                                             max(self.axis_x_array))
            self.pymca_graph.replot()

    def add_new_plot_value(self, x, y):
        """
        Descript. :
        """
        if self.realtime_plot:
            self.axis_x_array.append(x / 1000.0)
            self.axis_y_array.append(y / 1000.0)
#.........这里部分代码省略.........
开发者ID:MartinSavko,项目名称:mxcube,代码行数:103,代码来源:Qt4_pymca_plot_widget.py


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