Exemple #1
0
    def __init__(self, parent, id):
        self.plotController = []
        self.current_plotController = 0
        self.loadFlag = False
        self.mainView = MainView(parent, -1)
        self.timer = wx.Timer(self.mainView)
        self.currentVolume = 5
        self.toolbar = []

        fig1 = plt.figure(1, figsize=(16, 4.3), dpi=80)
        fig2 = plt.figure(2, figsize=(16, 4.3), dpi=80)
        self.valence_canvas = FigureCanvasWxAgg(self.mainView.valencePanel, -1,
                                                fig1)
        self.arousal_canvas = FigureCanvasWxAgg(self.mainView.arousalPanel, -1,
                                                fig2)
        fig1.canvas.mpl_connect('button_press_event', self.onClick)
        fig2.canvas.mpl_connect('button_press_event', self.onClick)
        #will be moved to main view
        #self.mainView.sizer.Add(self.canvas, (1,6), span=(8,5))
        # self.mainView.valencePanel.Fit()
        # self.mainView.arousalPanel.Fit()

        self.connect(parent)
        self.timer.Start(100)
        self.fps = 1
        self.previewImage = []
        self.vid_path = ""
Exemple #2
0
    def __init__(self, parent):
        super().__init__(parent, wx.ID_ANY)

        self.lastplot_1 = None
        self.lastplot_2 = None
        self.lastplot_3 = None

        self.figure_1 = Figure()
        self.axes_1 = self.figure_1.add_subplot(111)
        self.canvas_1 = FigureCanvasWxAgg(self, -1, self.figure_1)

        self.figure_2 = Figure()
        self.axes_2 = self.figure_2.add_subplot(111)
        self.canvas_2 = FigureCanvasWxAgg(self, -1, self.figure_2)

        self.figure_3 = Figure()
        self.axes_3 = self.figure_3.add_subplot(111)
        self.canvas_3 = FigureCanvasWxAgg(self, -1, self.figure_3)

        self.graphGenerator()

        layout = wx.GridSizer(3, 1, gap=(10, 10))
        layout.Add(self.canvas_1, flag=wx.EXPAND)
        layout.Add(self.canvas_2, flag=wx.EXPAND)
        layout.Add(self.canvas_3, flag=wx.EXPAND)
        self.SetSizer(layout)

        self.timer_reload = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.graphReloader, self.timer_reload)
        self.timer_reload.Start(150)
Exemple #3
0
 def __init__(self, parent, name, unit):
     wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
                       style=wx.TAB_TRAVERSAL)
     MainSizer = wx.BoxSizer(wx.VERTICAL)
     self.title = name + unit
     self.name = name
     self.unit = unit
     self.data = None
     MplSizer = wx.BoxSizer(wx.VERTICAL)
     # 配置项『
     self.dpi = 100
     self.facecolor = '#FEF9E7'
     self.data_limit_length = 120
     self.min_tc = None
     self.max_tc = None
     # 配置项』
     self.x_limit_range = numpy.arange(self.data_limit_length)
     self.blank_array = numpy.array([])
     self.Figure = Figure((1.6, 0.9), self.dpi)
     self.Axes = self.Figure.add_axes([0.05, 0.02, 0.93, 0.96])
     self.FigureCanvas = FigureCanvasWxAgg(self, -1, self.Figure)
     MplSizer.Add(self.FigureCanvas, 1, wx.EXPAND | wx.ALL, 0)
     MainSizer.Add(MplSizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 1)
     self.SetSizer(MainSizer)
     self.Update()
     self.timer = wx.Timer(self)
     self.Bind(wx.EVT_TIMER, self.refresh, self.timer)
Exemple #4
0
    def __init__(self):
        Frame.__init__(self, None, -1, "Test embedded wxFigure")

        self.fig = Figure((5, 4), 75)
        self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
        self.toolbar = NavigationToolbar2Wx(self.canvas)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.canvas.GetSizeTuple()
        self.toolbar.SetSize(Size(fw, th))

        # Create a figure manager to manage things

        # Now put all into a sizer
        sizer = BoxSizer(VERTICAL)
        # This way of adding to sizer allows resizing
        sizer.Add(self.canvas, 1, LEFT | TOP | GROW)
        # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, GROW)
        self.SetSizer(sizer)
        self.Fit()
        EVT_TIMER(self, TIMER_ID, self.onTimer)
    def OnSliderScroll(self, event):
        """
        Adjust marker size for plotting the annotations
        """
        from skimage import io
        self.drs = []
        plt.close(self.fig1)
        self.canvas.Destroy()
        self.fig1, (self.ax1f1) = plt.subplots(figsize=self.img_size,facecolor = "None")
        self.markerSize = (self.slider.GetValue())
        im = io.imread(self.index[self.iter])
        im_axis = self.ax1f1.imshow(im,self.colormap)
        cbar = self.fig1.colorbar(im_axis, ax = self.ax1f1)
        cbar.set_ticks(range(12,np.max(im),int(np.floor(np.max(im)/len(self.bodyparts)))))
        cbar.set_ticklabels(self.bodyparts)
        img_name = Path(self.index[self.iter]).name #self.index[self.iter].split('/')[-1]
        self.ax1f1.set_title(str(str(self.iter)+"/"+str(len(self.index)-1) +" "+ img_name ))
        self.canvas = FigureCanvasWxAgg(self, -1, self.fig1)
        normalize = mcolors.Normalize(vmin=np.min(self.colorparams), vmax=np.max(self.colorparams))

        for idx, bp in enumerate(self.updatedCoords):
            col = self.updatedCoords[idx][-1][-1]
            #color = self.colormap(normalize(col))
            x1 = self.updatedCoords[idx][-1][0]
            y1 = self.updatedCoords[idx][-1][1]
            circle = [patches.Circle((x1, y1), radius=self.markerSize, alpha=0.5)]
            self.ax1f1.add_patch(circle[0])
            self.cidClick = self.canvas.mpl_connect('button_press_event', self.onClick)
Exemple #6
0
    def __init__(self, parent, all_data):
        wx.Panel.__init__(self, parent=parent)
        plt.style.use('bmh')

        # matplotlib figure
        self.figure = Figure()
        self.ax = self.figure.subplots()
        money_list = [money[2] for money in all_data]
        if money_list == []:
            max_money = 1000
        else:
            max_money = max(money_list)
        hist_bins = round(max_money / 1000)
        self.ax.hist(money_list,
                     histtype='barstacked',
                     bins=hist_bins,
                     range=(0, hist_bins * 1000),
                     rwidth=1)

        # canvas
        self.canvas = FigureCanvasWxAgg(self, wx.ID_ANY, self.figure)
        self.canvas.SetBackgroundColour(wx.Colour(100, 255, 255))

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, flag=wx.EXPAND)
        self.SetSizer(sizer)
        self.Fit()
Exemple #7
0
    def createPlotsArea(self):
        # Read the pipeline data
        self.dataPlotManager.readFitsData(self.all_fitsFiles)
        # The matplotlib figure
        self.figure = Figure()
        self.figureCanvas = FigureCanvasWxAgg(self.plotPanel, wx.ID_ANY,
                                              self.figure)
        #    self.canvas.SetToolTip(wx.ToolTip(tip = ''))
        # Setup toolbar
        self.toolbar = reflex_navigation_toolbar.ReflexNavigationToolbar(
            self.figureCanvas)
        self.frame.SetToolBar(self.toolbar)
        # Bind actions for status bar and tooltips
        self.figureCanvas.mpl_connect('motion_notify_event', self.onMotion)
        self.figureCanvas.mpl_connect('axes_enter_event', self.onEnterAxes)
        self.figureCanvas.mpl_connect('axes_leave_event', self.onLeaveAxes)

        # Bind actions for proper size
        self.plotPanel.Bind(wx.EVT_SIZE, self.onResize)
        self.plotPanel.Bind(wx.EVT_IDLE, self.onIdle)

        self.needs_resize = False
        self.dataPlotManager.addSubplots(self.figure)
        self.dataPlotManager.plotProductsGraphics()
        self.figure.subplots_adjust(wspace=0.40,
                                    hspace=0.40,
                                    top=0.93,
                                    bottom=0.07,
                                    left=0.1,
                                    right=0.95)
Exemple #8
0
 def __init__(self, parent, dpi=None, **kwargs):
     wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, **kwargs)
     self.ztv_frame = self.GetTopLevelParent()
     self.figure = Figure(dpi=None, figsize=(1.,1.))
     self.axes = self.figure.add_subplot(111)
     self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
     self.Bind(wx.EVT_SIZE, self._onSize)
    def initUI(self):
        """
        Start the user interface.
        """

        self.statusbar = self.CreateStatusBar()

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        # Add plots to panel 1
        panel = wx.Panel(self, -1)
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.figure = Figure()
        self.canvas = FigureCanvasWxAgg(panel, -1, self.figure)
        self.toolbar = NavigationToolbar2WxAgg(self.canvas)
        self.toolbar.Realize()
        vbox1.Add(self.canvas, 1, wx.ALIGN_LEFT | wx.EXPAND)
        vbox1.Add(self.toolbar, 0, wx.ALIGN_LEFT)
        panel.SetSizer(vbox1)
        hbox.Add(panel, 1, wx.EXPAND)

        # Use some sizers to see layout options
        self.SetSizer(hbox)
        self.SetAutoLayout(1)
        hbox.Fit(self)
Exemple #10
0
    def __init__(self, *args, **kwargs):
        wx.Window.__init__(self, *args, **kwargs)

        hdu = fits.open('cmb_maps.fits')
#        hdu = fits.open('einstein_pack.fits')
#        hdu = fits.open('planck-satellite_pack.fits')
        self.sky = np.transpose(hdu[0].data)
        hdu.close()

        self.A0 = Param(10., minimum=0., maximum=10., id=0)
        self.A1 = Param(10., minimum=0., maximum=10., id=1)
        self.A2 = Param(10., minimum=0., maximum=10., id=2)
        self.A3 = Param(10., minimum=0., maximum=10., id=3)
        self.A4 = Param(10., minimum=0., maximum=10., id=4)
        self.A5 = Param(10., minimum=0., maximum=10., id=5)
        self.A6 = Param(10., minimum=0., maximum=10., id=6)
        self.A7 = Param(10., minimum=0., maximum=10., id=7)
        self.figure = Figure()
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.draw()

        self.A0.attach(self)
        self.A1.attach(self)
        self.A2.attach(self)
        self.A3.attach(self)
        self.A4.attach(self)
        self.A5.attach(self)
        self.A6.attach(self)
        self.A7.attach(self)
        self.Bind(wx.EVT_SIZE, self.sizeHandler)
Exemple #11
0
 def createCanavs(self, parent):
     self.figure = Figure()
     self.canvas = FigureCanvasWxAgg(parent, -1, self.figure)
     # Event callback binding for matplotlib
     # TODO
     self.canvas.draw()
     self.createPlots()
Exemple #12
0
    def __init__(self, parent, id):
        wx.Frame.__init__(
            self,
            parent,
            id,
            "scrollable plot",
            style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER,
            size=(800, 400),
        )
        self.panel = wx.Panel(self, -1)

        self.fig = Figure((5, 4), 75)
        self.canvas = FigureCanvasWxAgg(self.panel, -1, self.fig)
        self.scroll_range = 400
        self.canvas.SetScrollbar(wx.HORIZONTAL, 0, 5, self.scroll_range)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, -1, wx.EXPAND)

        self.panel.SetSizer(sizer)
        self.panel.Fit()

        self.init_data()
        self.init_plot()

        self.canvas.Bind(wx.EVT_SCROLLWIN, self.OnScrollEvt)
Exemple #13
0
    def __init__(self, parent, color=None, dpi=None, **kwargs):
        # initialize Panel
        if 'id' not in kwargs.keys():
            kwargs['id'] = wx.ID_ANY
        if 'style' not in kwargs.keys():
            kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE

        self.parent = parent
        wx.Panel.__init__(self, parent, **kwargs)

        # initialize matplotlib stuff
        self.figure = Figure(None, dpi, frameon=True, tight_layout=False)
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.SetColor(color)

        # Wire up mouse event
        #self.canvas.mpl_connect('motion_notify_event', self.on_mouse_motion)
        #self.canvas.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)

        self._SetSize()
        self.draw()

        self._resizeflag = False

        self.Bind(wx.EVT_IDLE, self._onIdle)
        self.Bind(wx.EVT_SIZE, self._onSize)
Exemple #14
0
    def __init__(self, parent):
        super().__init__(parent, wx.ID_ANY)
        self.SetBackgroundColour('#EEEEFF')

        self.fig = Figure()

        self.axs = self.fig.add_subplot(1, 1, 1)
        self.axs.set_xlim((-np.pi, np.pi))
        self.axs.set_ylim((0, 1.1))

        self.line_2, = self.axs.plot([], [],
                                     color='black',
                                     linestyle='--',
                                     linewidth=0.5)
        self.line_3, = self.axs.plot([], [],
                                     color='blue',
                                     linestyle='-',
                                     linewidth=2.0)
        self.line_4, = self.axs.plot([], [],
                                     color='blue',
                                     linestyle='None',
                                     marker='o')

        self.canvas = FigureCanvasWxAgg(self, wx.ID_ANY, self.fig)

        layout = wx.BoxSizer(wx.VERTICAL)
        layout.Add(self.canvas, flag=wx.GROW)
        self.SetSizer(layout)

        xp = np.arange(-np.pi, np.pi, 0.01)
        yp = 0.5 - 0.5 * np.cos(xp)
        self.line_2.set_data(xp, yp)
Exemple #15
0
    def _initFigure(self):
        ##Create a matplotlib figure/canvas in this panel
        ##the background colour will be the same as the panel
        ##the size will also be the same as the panel
        ##calculate size in inches
        pixels_width, pixels_height = self.GetSizeTuple()
        self.dpi = 96.0
        inches_width = pixels_width / self.dpi
        inches_height = pixels_height / self.dpi

        ##calculate colour in RGB 0 to 1
        colour = self.GetBackgroundColour()
        self.fig = Figure(figsize=(inches_width,inches_height), dpi = self.dpi\
            ,facecolor=(colour.Red()/255.0, colour.Green()/255.0, colour.Blue()/255.0)\
            ,edgecolor=(colour.Red()/255.0, colour.Green()/255.0, colour.Blue()/255.0))

        self.canvas = FigureCanvasWxAgg(self, -1, self.fig)

        self.fig.subplots_adjust(left=0.05, right=0.95, wspace=0.08)

        ##now put everything in a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        # This way of adding to sizer allows resizing
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.Fit()
Exemple #16
0
    def __init__(self, *args, **kwargs):
        wx.Window.__init__(self, *args, **kwargs)

        self.cmap = 'gray'
        self.load_image("Cloudy noise")
        self.amp = np.zeros(8, 'f')

        self.A0 = Param(10., minimum=0., maximum=10., amp=self.amp, id=0)
        self.A1 = Param(10., minimum=0., maximum=10., amp=self.amp, id=1)
        self.A2 = Param(10., minimum=0., maximum=10., amp=self.amp, id=2)
        self.A3 = Param(10., minimum=0., maximum=10., amp=self.amp, id=3)
        self.A4 = Param(10., minimum=0., maximum=10., amp=self.amp, id=4)
        self.A5 = Param(10., minimum=0., maximum=10., amp=self.amp, id=5)
        self.A6 = Param(10., minimum=0., maximum=10., amp=self.amp, id=6)
        self.A7 = Param(10., minimum=0., maximum=10., amp=self.amp, id=7)
        self.figure = Figure()
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.draw()

        self.A0.attach(self)
        self.A1.attach(self)
        self.A2.attach(self)
        self.A3.attach(self)
        self.A4.attach(self)
        self.A5.attach(self)
        self.A6.attach(self)
        self.A7.attach(self)
        self.Bind(wx.EVT_SIZE, self.sizeHandler)
Exemple #17
0
	def __init__(self, parent, color=None, dpi=None, **kwargs):
		from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
		from matplotlib.figure import Figure
		
		# set default matplotlib parameters
		import matplotlib as mpl
		fontSize = 10
		mpl.rcParams['font.size'] = fontSize
		mpl.rcParams['axes.titlesize'] = fontSize
		mpl.rcParams['axes.labelsize'] = fontSize
		mpl.rcParams['xtick.labelsize'] = fontSize
		mpl.rcParams['ytick.labelsize'] = fontSize
		mpl.rcParams['legend.fontsize'] = fontSize

		# initialize Panel
		if 'id' not in kwargs.keys():
				kwargs['id'] = wx.ID_ANY
		if 'style' not in kwargs.keys():
				kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
		wx.Panel.__init__(self, parent, **kwargs)

		# initialize matplotlib stuff
		self.figure = Figure(None, dpi)
		self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
		self.SetColor( color )

		self.SetPlotSize()
		
		self._resizeFlag = False
		
		parent.Bind(wx.EVT_SIZE, self._OnSize)
		self.Bind(wx.EVT_IDLE, self._OnIdle)
Exemple #18
0
    def __init__(self, parent):
        w, h = parent.GetSize()
        wx.Panel.__init__(self, parent=parent, size=(w, 0.7*h), style=wx.SUNKEN_BORDER)
        self.parent = parent
        self.legends = []
        self.legendpos = [0.5, 1]

        self.fig = Figure(figsize=(12, 6), dpi=90)  # create a figure size 8x6 inches, 80 dots per inches
        self.splts = []
        self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
        self.toolbar = Toolbar(self.canvas)  # matplotlib toolbar
        # additional toolbar
        status_txt = wx.StaticText(self.toolbar, label='    Status on hover: ', pos=(230, 7), \
                                   size=(100, 17))
        self.status = wx.TextCtrl(self.toolbar, pos=(330,4), size=(300, 22), \
                                  style=wx.TE_READONLY)
        self.toolbar.Realize()

        self.figw, self.figh = self.fig.get_window_extent().width, self.fig.get_window_extent().height

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toolbar, 0, wx.GROW)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.box_width_fraction = 1.0
        self.box_height_fraction = 0.9
        self.lines = []
        self.lined = dict()
        self.draggableList = ['Text', 'Legend']
        # print(self.toolbar.GetBackgroundColour())

        self.fig.canvas.mpl_connect('resize_event', self.squeeze_legend)
        self.fig.canvas.mpl_connect('pick_event', self.on_pick)
        self.fig.canvas.mpl_connect('motion_notify_event', self.on_motion)
        self.fig.canvas.mpl_connect('figure_leave_event', self.on_leave)
Exemple #19
0
    def __init__(self, parent, color=None, dpi=None, **kwargs):
        from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
        from matplotlib.figure import Figure

        self.parent = parent

        # initialize Panel
        if 'id' not in kwargs.keys():
            kwargs['id'] = wx.ID_ANY
        if 'style' not in kwargs.keys():
            kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
        wx.Panel.__init__(self, parent, **kwargs)

        # initialize matplotlib stuff
        self.figure = Figure(None, dpi)
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.SetColor(color)

        self._SetSize()
        #self.draw()

        self._resizeflag = False

        #self.Bind(wx.EVT_IDLE, self._onIdle)
        self.Bind(wx.EVT_SIZE, self._onSize)
Exemple #20
0
 def __init__(self):
     super(MyFrame, self).__init__(None, wx.ID_ANY, size=(800, 600))
     self.fig = mfigure.Figure()
     self.ax = self.fig.add_subplot(111)
     self.canv = FigureCanvasWxAgg(self, wx.ID_ANY, self.fig)
     self.values = []
     self.animator = manim.FuncAnimation(self.fig, self.anim, interval=100)
Exemple #21
0
    def __init__(self, parent, color=None, dpi=None, **kwargs):
        from matplotlib.backends.backend_wxagg import (FigureCanvasWxAgg,
                                                       NavigationToolbar2WxAgg)
        from matplotlib.figure import Figure

        # initialize Panel
        if 'id' not in kwargs.keys():
            kwargs['id'] = wx.ID_ANY
        if 'style' not in kwargs.keys():
            kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
        wx.Panel.__init__(self, parent, **kwargs)
        self.parent = parent

        # initialize matplotlib stuff
        self.figure = Figure(None, dpi)
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.ax = self.figure.add_subplot(111)
        self.figure.subplots_adjust(hspace=0.8)
        self.toolbar = NavigationToolbar2WxAgg(self.canvas)

        vSizer = wx.BoxSizer(wx.VERTICAL)
        vSizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        vSizer.Add(self.toolbar, 0, wx.EXPAND)
        self.draw()
        self.SetAutoLayout(True)
        self.SetSizer(vSizer)
        self.Layout()
    def __init__(self, *args, **kwargs):

        if "figsize" in kwargs:
            self.figure = Figure(figsize=kwargs["figsize"])
            self._axes = [0.1, 0.1, 0.8, 0.8]
            del kwargs["figsize"]
        else:
            self.figure = Figure(figsize=[8, 2.5])

        self.figure.set_facecolor('white')

        wx.Window.__init__(self, *args, **kwargs)
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.figure.set_facecolor('white')
        self.figure.set_edgecolor('white')
        self.canvas.SetBackgroundColour('white')

        # Create a resizer
        self.Bind(wx.EVT_SIZE, self.sizeHandler)
        self.resize = 1

        #         self.canvas.mpl_connect('motion_notify_event', self.onMotion)

        # Prepare for zoom
        self.zoom = None
        self.zoomtype = "box"
Exemple #23
0
    def __init__(self):
        wx.Frame.__init__(self, None, -1, self.title)

        # handle window close event
        self.Bind(wx.EVT_CLOSE, self.on_exit)

        # creat plot objects to store data
        self.plots = dict()
        for key in self.PLOT_KEYS:
            self.plots[key] = Plot()

        # set data source
        self.source = UDPComs(self)

        self.panel = wx.Panel(self, 1)

        self.init_plot()
        self.canvas = FigureCanvasWxAgg(self.panel, -1, self.fig)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.canvas, 1, flag=wx.EXPAND)

        self.panel.SetSizer(self.vbox)
        self.vbox.Fit(self)

        self.is_running = True
        self.update_thread = Thread(target=self.update_plot_thread)
        self.update_thread.start()
    def __init__(self, parent, name, louvain_dict, t_dict, division_num, col,
                 cluster_limit, m_path):
        from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
        from matplotlib.figure import Figure
        self.parent = parent
        self.name = name
        self.cluster_limit = cluster_limit
        self.m_path = m_path
        # グラフ部分のサイズ指定
        wx.Panel.__init__(self, parent, size=(1000, 500))
        self.figure = Figure(None)
        self.figure.set_facecolor((0.9, 0.9, 1.))
        self.subplot = self.figure.add_subplot(111)

        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.EXPAND)
        self.SetSizer(sizer)

        # 可視化用のデータ作成
        create_themeriver(louvain_dict,
                          t_dict,
                          self.subplot.axes,
                          division_num=division_num,
                          col=col,
                          cluster_limit=len(col))
        # 凡例作成
        create_legend(louvain_dict,
                      t_dict,
                      self.subplot.axes,
                      self.name,
                      division_num=division_num,
                      cluster_limit=len(col),
                      m_path=self.m_path)
        self.draw()
Exemple #25
0
 def __init__(self,
              parent,
              ID=-1,
              label="",
              pos=wx.DefaultPosition,
              size=(100, 25)):
     #(0) Initialize panel:
     wx.Panel.__init__(self,
                       parent,
                       ID,
                       pos,
                       size,
                       style=wx.STATIC_BORDER | wx.WANTS_CHARS,
                       name=label)
     self.SetMinSize(size)
     self.parent = parent
     self.q = [0, 0, 0, 1]
     self.th = 5
     #(1) Create Matplotlib figure:
     self.figure = Figure(facecolor='0.8')
     self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
     self._resize()
     self._create_axes()
     self.canvas.Bind(wx.EVT_KEY_DOWN, self.callback_key)
     self.canvas.Bind(wx.EVT_CHAR_HOOK, self.callback_key)
Exemple #26
0
    def __init__(self, parent, title, size):
        wx.Frame.__init__(self, parent, title=title, size=size)

        self.menubar = wx.MenuBar()
        self.file = wx.Menu()
        menusavefig = self.file.Append(wx.ID_ANY, '&Save figure',\
                                       "Save the current figure")
        menuexit = self.file.Append(wx.ID_EXIT, \
                                    '&Exit', u"Close Fourier Frame")
        self.menubar.Append(self.file, '&File')
        self.SetMenuBar(self.menubar)

        self.figure = Figure()
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.EXPAND)
        self.SetSizer(self.sizer)

        self.Bind(wx.EVT_MENU, self._OnSave, menusavefig)
        self.Bind(wx.EVT_MENU, self._OnClose, menuexit)
        self.Bind(wx.EVT_CLOSE, self._OnClose)

        self.toolbar = NavigationToolbar2Wx(self.canvas)
        self.toolbar.Realize()
        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
        self.toolbar.update()
Exemple #27
0
    def __init__(self, parent, color=None, dpi=None, **kwargs):
        from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
        from matplotlib.figure import Figure

        # initialize Panel
        if 'id' not in kwargs.keys():
            kwargs['id'] = wx.ID_ANY
        if 'style' not in kwargs.keys():
            kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
        wx.Panel.__init__(self, parent, **kwargs)

        # initialize matplotlib stuff
        self.figure = Figure(None, dpi)
        self.axes = self.figure.gca()
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.SetColor(color)

        self._SetSize()
        self.draw()
        self.axes.set_xlabel('T (s)')
        self.axes.set_ylabel('Alfa_max (g)')
        self.axes.set_title("wave curve")
        self.axes.grid(True)
        self._resizeflag = False

        self.Bind(wx.EVT_IDLE, self._onIdle)
        self.Bind(wx.EVT_SIZE, self._onSize)
def addFigAx2Panel(panel, *args, **kw_args):
    sizer = wx.BoxSizer(wx.VERTICAL)
    fig, ax = plt.subplots(*args, **kw_args)
    canvas = FigureCanvasWxAgg(panel, -1, fig)
    sizer.Add(canvas, 1, wx.EXPAND)
    panel.SetSizer(sizer)
    return fig, ax, canvas
Exemple #29
0
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "Test embedded wxFigure")

        self.fig = Figure((5, 4), 75)
        self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
        self.toolbar = Toolbar(self.canvas)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.canvas.GetSizeTuple()
        self.toolbar.SetSize(wx.Size(fw, th))

        # Initialise the timer - wxPython requires this to be connected to
        # the receiving event handler
        self.t = wx.Timer(self, TIMER_ID)
        self.t.Start(10)

        # Create a figure manager to manage things

        # Now put all into a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        # This way of adding to sizer allows resizing
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wx.GROW)
        self.SetSizer(sizer)
        self.Fit()
        self.Bind(wx.EVT_TIMER, self.onTimer, id=TIMER_ID)
        self.Bind(wx.EVT_CLOSE, self.onClose)
Exemple #30
0
    def __init__(self, parent, headers, color=None, dpi=None, **kwargs):
        from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
        from matplotlib.figure import Figure

        self.overlay = False
        self.trend = False

        if 'id' not in kwargs.keys():
            kwargs['id'] = wx.ID_ANY
        if 'style' not in kwargs.keys():
            kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
        wx.Panel.__init__(self, parent, **kwargs)

        self.figure = Figure(None, dpi)
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.canvas.mpl_connect('button_release_event', self.on_release)

        self.SetColor(color)

        self.hs0 = wx.GridSizer(rows=20, cols=2, vgap=6, hgap=6)
        self.hs1 = wx.BoxSizer(wx.VERTICAL)
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.hs0, flag=wx.EXPAND)
        self.sizer.Add(self.canvas, wx.EXPAND)
        self.sizer.Add(self.hs1, flag=wx.EXPAND)
        self.add_toolbar()
        self.SetSizer(self.sizer)

        self._SetSize()
        self.draw()

        self._resizeflag = False

        self.Bind(wx.EVT_IDLE, self._onIdle)
        self.Bind(wx.EVT_SIZE, self._onSize)