|
From: C M <cmp...@gm...> - 2015-01-03 06:36:42
|
Still though, I thought we had enough logic checks to prevent this sort of
>> error. I see you are using Python 2.5, which is older than what we
>> currently support. Which version of matplotlib are you using?
>>
>
> I'm using matplotlib 1.1.0. I could try upgrading.
>
Ben and others,
OK, I tried upgrading to Python 2.6 and Matplotlib 1.4.2. The problem with
the singular matrix goes away! But...
...But now I have no patch shown on the plot. This is the function I am
using now to add a patch (editing to just keep the MPL relevant
stuff)...maybe this is no longer a good way?:
def AddPatch(self,):
ax = self.subplot
verts = [
(start, y-scaling_value), # left, bottom
(start, y+scaling_value), # left, top
(stop, y+scaling_value), # right, top
(stop, y-scaling_value), # right, bottom
(0., 0.), # ignored
]
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]
x = [start, stop] # x range of box (in data
coordinates)
height = 12 # of box in device coords (pixels)
path = mpath.Path([[x[0], -height], [x[1], -height],
[x[1], height], [x[0], height],
[x[0], -height]])
#USING THE NEW TRANSFORMS
fixed_pt_trans = FixedPointOffsetTransform(ax.transData,
(0, y))
xdata_yfixed =
mtrans.blended_transform_factory(ax.transData, fixed_pt_trans)
patch = patches.PathPatch(path, transform=xdata_yfixed,
facecolor=color,alpha=0.4, lw=1, edgecolor='grey')
ax.add_patch(patch)
|