FW: edgecolor=“black” not drawing properly
Hi
The option to set the edge of a mpl canvas isn’t working properly – it’s out by one pixel on the top and right hand sides. Python 2.6.6, wx, mpl 1.0.
Could this be added to the bug list to be fixed please?
Thx
David
import wx
from wx.lib.scrolledpanel import ScrolledPanel
import matplotlib as mpl
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
app = wx.PySimpleApp()
frame = wx.Frame(None, id=wx.ID_ANY, name=“mainFrame”, size=(500,500))
panel = wx.Panel(frame)
create a scrollablePanel to hold the canvas
scrollablePanel = ScrolledPanel(parent=panel, id=wx.ID_ANY, name=“scrolledPanel”, style=wx.ALWAYS_SHOW_SB)
scrollablePanel.SetupScrolling()
scrollablePanel.SetBackgroundColour(wx.Colour(128,128,128))
create mpl canvas and figure
mplFigure = Figure(figsize=(5,5), facecolor=“white”, edgecolor=“black”)
mplFigureCanvas = FigureCanvasWxAgg(parent=scrollablePanel, id=wx.ID_ANY, figure=mplFigure)
center the FigureCanvas inthe scrollablePanel
sizer1 = wx.BoxSizer(wx.VERTICAL)
sizer1.Add(mplFigureCanvas, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, border=8)
sizer2 = wx.BoxSizer(wx.HORIZONTAL)
sizer2.Add(sizer1, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
scrollablePanel.SetSizer(sizer2)
use another sizer to add the scrollablePanel to the main panel
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(scrollablePanel, 1, wx.LEFT | wx.EXPAND)
panel.SetSizer(sizer)
mplFigure.clear()
ax1 = mplFigure.add_subplot(111)
mplFigureCanvas.draw()
frame.Show()
app.MainLoop()
disclaim.txt (2.02 KB)