I'd like to plot a collection and scale the size of the collection elements in relation to the data. My guess is that I need to use the data transformation (ax.transData) since I would like the size of the collection elements altered when zooming in/out.
Unfortunately, my attempt has led to weird results: the collection offsets are shifted from the desired coordinates when using ax.transData. Weirder still: the collection elements move *relative to the data coordinates* when panning the figure. I suspect that setting the collection transform to ax.transData is somehow applying some part of the transform twice. Does anyone know what I'm doing wrong here and how I can fix this? Thanks! -Tony Attached is a toy example of what I'm trying to do. The radii of the circles are plotted correctly, but notice the x, y coordinates don't match the circle centers in the plot. Also, try panning the plot and watch as the circles move relative to the tick marks. >>> import matplotlib.pyplot as plt >>> import matplotlib.transforms as transforms >>> import numpy as np >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> x = [0.25, 0.75, 0.25, 0.75] >>> y = [0.25, 0.25, 0.75, 0.75] >>> r = 0.1 * np.ones(4) >>> col = plt.scatter(x, y, np.pi*r**2) >>> pts2pixels = transforms.Affine2D().scale(72.0/fig.dpi) >>> col.set_transform(pts2pixels + ax.transData) >>> plt.axis('equal') >>> plt.show() ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users