I have successfully placed a matplotlib line chart on a wxpython panel, but the margins look too big to me. I want to reduce the margins, so that the chart will expand to the panel (or almost expand). I tried self.fig.tight_layout() but it didn't reduce the margins
import wx
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
class GraphFrame():
def __init__(self, parent):
self.parent = parent
self.dpi = 100
self.fig = Figure((3.0, 3.0), dpi=self.dpi)
self.canvas = FigCanvas(self.parent, -1, self.fig)
self.axes = self.fig.add_subplot(111)
self.fig.tight_layout()
self.canvas.draw()
chart_panel = wx.Panel(self.main_Frame, -1)
chart = GraphFrame(chart_panel)