def CreatePlotCanvases(self): """Create plot canvases according to the number of bands""" for band in self.bandList: canvas = plot.PlotCanvas(self.canvasPanel) canvas.SetMinSize((-1, 140)) canvas.SetFontSizeTitle(10) canvas.SetFontSizeAxis(8) self.canvasList.append(canvas) self.canvasSizer.Add(item=canvas, proportion=1, flag=wx.EXPAND, border=0) self.SetVirtualSize(self.GetBestVirtualSize()) self.Layout()
def __init__(self, parent=None, size=wx.Size(700, 400), style=wx.DEFAULT_FRAME_STYLE, rasterList=[], **kwargs): wx.Frame.__init__(self, parent, id=wx.ID_ANY, size=size, style=style, **kwargs) self.parent = parent # MapFrame for a plot type self.Map = Map( ) # instance of render.Map to be associated with display self.rasterList = rasterList # list of rasters to plot self.raster = { } # dictionary of raster maps and their plotting parameters self.plottype = '' self.linestyledict = { 'solid': wx.SOLID, 'dot': wx.DOT, 'long-dash': wx.LONG_DASH, 'short-dash': wx.SHORT_DASH, 'dot-dash': wx.DOT_DASH } self.ptfilldict = {'transparent': wx.TRANSPARENT, 'solid': wx.SOLID} # # Icon # self.SetIcon( wx.Icon(os.path.join(ICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO)) # # Add statusbar # self.statusbar = self.CreateStatusBar(number=2, style=0) self.statusbar.SetStatusWidths([-2, -1]) # # Define canvas and settings # # self.client = plot.PlotCanvas(self) # define the function for drawing pointLabels self.client.SetPointLabelFunc(self.DrawPointLabel) # Create mouse event for showing cursor coords in status bar self.client.canvas.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown) # Show closest point when enabled self.client.canvas.Bind(wx.EVT_MOTION, self.OnMotion) self.plotlist = [] # list of things to plot self.plot = None # plot draw object self.ptitle = "" # title of window self.xlabel = "" # default X-axis label self.ylabel = "" # default Y-axis label self.CentreOnScreen() self._createColorDict()