Exemplo n.º 1
0
    def __init__(self, parent=None):
        """
        Initialization
        :return:
        """
        #
        self._myParentWindow = parent

        # Initialize the figure
        self._myFigure = Figure()

        # Init canvas
        FigureCanvas.__init__(self, self._myFigure)
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # Axes
        self._myAxes = Axes3D(
            self._myFigure)  # Canvas figure must be created for mouse rotation
        self.format_coord_org = self._myAxes.format_coord
        self._myAxes.format_coord = self.report_pixel

        # color
        self._colorMap = [0.5, 0.5, 0.5]

        # Others
        self._dataKey = 0
        self._dataDict = dict()

        # List of plots on canvas NOW
        self._currPlotList = list()
        self._currSurfaceList = list()  # [{"xx":,"yy:","val:"}]

        return
Exemplo n.º 2
0
    def __init__(self, parent):
        """  Initialization
        """
        # Instantiating matplotlib Figure
        self.fig = Figure()
        self.fig.patch.set_facecolor('white')

        # Initialize parent class and set parent
        super(Qt4MplPolarCanvas, self).__init__(self.fig)
        self.setParent(parent)

        # Set size policy to be able to expanding and resizable with frame
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # set up axis/subplot (111) only for 2D
        self.axes = self.fig.add_subplot(111, polar=True)  # return: matplotlib.axes.AxesSubplot

        # general canvas setup
        self.fig.subplots_adjust(bottom=0.15)

        # plot management
        self._contourPlot = None

        # legend and color bar
        self._colorBar = None
        self._isLegendOn = False
        self._legendFontSize = 8

        return
Exemplo n.º 3
0
    def __init__(self, parent):
        """  Initialization
        """
        # Instantiating matplotlib Figure
        self.fig = Figure()
        self.fig.patch.set_facecolor('white')

        self.axes = self.fig.add_subplot(
            111)  # return: matplotlib.axes.AxesSubplot

        # Initialize parent class and set parent
        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)

        # Set size policy to be able to expanding and resizable with frame
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # legend and color bar
        self._colorBar = None

        # Buffer of data
        self._currentArray2D = None

        # image management data structure
        self._currIndex = 0
        self._imagePlotDict = dict()

        # image size
        self._xLimit = [0., 1.]
        self._yLimit = [0., 1.]

        return
Exemplo n.º 4
0
    def __init__(self, parent):
        self._driver = AddieDriver()
        # from mpl_toolkits.axes_grid1 import host_subplot
        # import mpl_toolkits.axisartist as AA
        # import matplotlib.pyplot as plt

        # Instantiating matplotlib Figure
        self.fig = Figure()
        self.fig.patch.set_facecolor('white')

        self.axes = self.fig.add_subplot(111, projection='mantid')
        self.fig.subplots_adjust(bottom=0.15)

        # Initialize parent class and set parent
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)

        # Set size policy to be able to expanding and resizable with frame
        FigureCanvasQTAgg.setSizePolicy(self, QSizePolicy.Expanding,
                                        QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self)

        # Variables to manage all lines/subplot
        self._lineDict = {}
        self._lineIndex = 0

        # legend and color bar
        self._colorBar = None
        self._isLegendOn = False
        self._legendFontSize = 10
Exemplo n.º 5
0
    def __init__(self, parent=None):
        """
        Initialization
        :return:
        """
        #
        self._myParentWindow = parent

        # Initialize the figure
        self._myFigure = Figure()

        # Init canvas
        FigureCanvas.__init__(self, self._myFigure)
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # Axes
        self._myAxes = Axes3D(self._myFigure)  # Canvas figure must be created for mouse rotation
        self.format_coord_org = self._myAxes.format_coord
        self._myAxes.format_coord = self.report_pixel

        # color
        self._colorMap = [0.5, 0.5, 0.5]

        # Others
        self._dataKey = 0
        self._dataDict = dict()

        # List of plots on canvas NOW
        self._currPlotList = list()
        self._currSurfaceList = list()  # [{"xx":,"yy:","val:"}]

        return
Exemplo n.º 6
0
    def __init__(self, parent):
        """  Initialization
        """
        # Instantiating matplotlib Figure
        self.fig = Figure()
        self.fig.patch.set_facecolor('white')

        # initialization
        super(Qt4Mpl2DCanvas, self).__init__(self.fig)

        # set up axis/subplot (111) only for 2D
        self.axes = self.fig.add_subplot(
            111, polar=False)  # return: matplotlib.axes.AxesSubplot
        self.axes.set_aspect('auto')

        # plot management
        self._scatterPlot = None
        self._imagePlot = None

        # Initialize parent class and set parent
        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)

        # Set size policy to be able to expanding and resizable with frame
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # Variables to manage all lines/subplot
        self._lineDict = {}
        self._lineIndex = 0

        # legend and color bar
        self._colorBar = None
        self._isLegendOn = False
        self._legendFontSize = 8

        return
Exemplo n.º 7
0
    def __init__(self, parent, row_size=None, col_size=None, rotate=False):
        """Initialization
        :param parent:
        :param row_size:
        :param col_size:
        """
        # Instantiating matplotlib Figure. It is a requirement to initialize a figure canvas
        self.fig = Figure()
        self.fig.patch.set_facecolor('white')

        # Initialize parent class and set parent
        super(Qt4MplCanvasMultiFigure, self).__init__(self.fig)
        self.setParent(parent)

        # Variables to manage all lines/subplot:  key = integer line ID, value = reference to line
        # default to 1 subplot at (0, 0)
        self._mainLineDict = dict()
        self._mainLineDict[0, 0] = dict()

        # right axes
        self._rightLineDict = dict()

        # line index: single index for both main and right plot
        self._lineIndex = 0

        # legend and color bar
        self._legendStatusDict = dict()
        self._legendRightStatusDict = dict()
        self._legendFontSize = 8

        # data structure for sub plots
        self._numSubPlots = 0
        self.axes_main = dict()  # keys are 2-tuple, starting from (0, 0)
        self.axes_right = dict()

        # the subplots are not set up in the initialization
        self.set_subplots(row_size=1, col_size=1, rotate=True)

        # Set size policy to be able to expanding and resizable with frame
        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        self._is_rotated = rotate

        # prototype ...

        vec_x = np.arange(0, 150, 1)
        vec_y = np.sin(vec_x)  # * np.pi / 180.)

        # first of all, the base transformation of the data points is needed
        # base = pyplot.gca().transData
        if rotate:
            # base = self.axes_main[0, 0].transData
            # rot = transforms.Affine2D().rotate_deg(270)
            # output = self.axes_main[0, 0].plot(vec_x, vec_y, 'r--', transform=rot + base)
            output = self.axes_main[0, 0].plot(vec_y, vec_x)
        else:
            output = self.axes_main[0, 0].plot(vec_x, vec_y, 'r--')
        self.axes_main[0, 0].set_aspect('auto')

        self._curr_plot = output[0]

        #
        # print data
        # print vec_x
        # print vec_y
        #
        #
        #
        # # define transformed line
        # # line = pyplot.plot(data, 'r--', transform= rot + base)
        # # line = pyplot.plot(vec_x, vec_y)
        # line = pyplot.plot(vec_x, vec_y, 'r--', transform=rot + base)
        # # or alternatively, use:
        # # line.set_transform(rot + base)

        # pyplot.show()

        return