I would like to adjust the shadow of the axes in the matplotlib plot. the shadow looks unsuitable for the other patches that I add to the plot. I need dx and dy to be at least 4 to show the perspective I'm looking for. since the only parameter is the boolean axis, there is no way to control the depth of the shadow. I am trying to create a Shadow object myself and add it to the legend, but it does not work correctly. please find an example here
import wx
import numpy as np
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
from matplotlib.legend import Legend
from matplotlib.patches import Shadow
from matplotlib.axes import Axes
from matplotlib.lines import Line2D
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
mainSizer = wx.BoxSizer(wx.VERTICAL)
self.figure = Figure(figsize=(4.5,4), dpi=None)
self.canvas = FigureCanvasWxAgg( self, -1, self.figure )
mainSizer.Add(self.canvas, proportion=1, flag=wx.ALL|wx.EXPAND)
self.SetSizer(mainSizer)
mainSizer.Fit(self)
self.Show(True)
data = np.array(range(100))**2/100.
app = wx.App(0)
frame = Frame()
axes = frame.figure.add_axes((0.1,0.1,0.8,0.8))
line = Line2D(xdata=range(len(data)), ydata=data)
axes.add_line(line)
axes.set_xlim(left=0,right=len(data))
axes.set_ylim(bottom=data[0],top=data[-1])
l = Legend(axes,[line],['parabola'], shadow=False)
s = Shadow(l.legendPatch, 5, -5)
axes.legend_ =l
axes.add_patch(s)
frame.canvas.draw()
app.MainLoop()
when the frame is displayed on the screen, the shadow is not drawn, it appears when I start to resize and sets strange or legend behind the legend, depending on how you resize. this is a snapshot of my weird shadow before and after resizing


Cobry