im folgenden Bsp. soll eine geplottetes Diagramm das blaue
panel VOLL ausfüllen, was es aber nicht tut:
Code: Alles auswählen
import wx
import wx.lib.plot as plot
DUMMYDATAl1 = [(90, 6370), (180, 6363), (270, 6386), (360, 6365), (450, 6364), (540, 6378), (630, 6372), (720, 6358), (810, 6360), (900, 6381), (990, 6367), (1080, 6374), (1170, 6381), (1260, 6370), (1350, 6360)]
class MyFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, ID, title, size=(300, 250))
panel1 = wx.Panel(self,-1, style=wx.SUNKEN_BORDER)
panel2 = wx.Panel(self,-1, style=wx.SUNKEN_BORDER)
panel1.SetBackgroundColour("BLUE")
panel2.SetBackgroundColour("RED")
l1 = DUMMYDATAl1 #########
ymin = min([x[1] for x in l1]) - 2
ymax = max([x[1] for x in l1]) + 2
xmin = l1[0][0] #index erstes
xmax = l1[-1][0] #index letzes
client = plot.PlotCanvas(panel1)
line = plot.PolyLine(l1, legend='', colour='pink', width=1)
gc = plot.PlotGraphics([line]) #, 'Line Graph', 'X Axis', 'Y Axis')
client.Draw(gc, xAxis= (xmin, xmax), yAxis= (ymin, ymax))
box = wx.BoxSizer(wx.VERTICAL)
box.Add(panel1, 2, wx.EXPAND)
box.Add(panel2, 1, wx.EXPAND)
self.SetAutoLayout(True)
self.SetSizer(box)
self.Layout()
app = wx.PySimpleApp()
frame = MyFrame(None, -1, "Plot Test")
frame.Show()
app.MainLoop()
joh