|
From: Gellule Xg <gel...@fr...> - 2009-10-07 02:40:13
|
>> This is a bug report for matplotlib version 0.99.1.1 >> >> The clip_path keyword of imshow() does not work when setting it to >> (Path, Transform) for two reasons: > > Hi, Thanks for the report. Do you have a simple test script that we can > use to see the problem and then fix it? We will then use this as the > basis to create a test function to make sure the issue never "crops" up > again. > > -Andrew Hi Andrew, Please try the following. It's a script that clips an NxN image based on its contour. Thanks, -Julien import numpy import pylab #Create a NxN image N=100 (x,y) = numpy.indices((N,N)) x -= N/2 y -= N/2 r = numpy.sqrt(x**2+y**2-x*y) #Create a contour plot at N/4 and extract both the clip path and transform c=pylab.contour(r,[N/4]) clipPath = c.collections[0].get_paths()[0] clipTransform = c.collections[0].get_transform() #Plot the image clipped by the contour pylab.imshow(r, clip_path=(clipPath,clipTransform)) pylab.show() |