I'd like to use the same patch to clip two images that share the same 
axes, and extract values from the un-clipped region of both arrays. 
Unfortunately this seems harder than expected. Code & questions below, 
Thanks!

from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
from numpy import random

poly = patches.Circle((5,5), radius=3, fill=False, ec='none')

fig = plt.figure()
ax = fig.add_subplot(121)
ax.autoscale_view(0,0,0)
test = random.rand(10,10)
im = ax.imshow(test)

test1 = random.rand(10,10)
# How to prevent automatic axis scaling?
ax1 = fig.add_subplot(122, sharex=ax, sharey=ax)
im1 = ax1.imshow(test1)

ax.add_patch(poly)
im.set_clip_path(poly)

# Doesn't work b/c poly vertices auto-transformed to display coords by 
add_patch?
ax1.add_patch(poly)
im1.set_clip_path(poly)

# How to extract non-clipped values instead of full array?
clipped_data = im.get_array()

plt.show()


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to