On Jun 22, 2009, at 2:57 PM, Jae-Joon Lee wrote:
> The easiest solution I can think of is doing some monkey patching.
>
>
> 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)
>
>
> from matplotlib.collections import RegularPolyCollection
> class RegularPolyCollection2(RegularPolyCollection):
>    def get_transform(self):
>        ax = self.axes
>
>        sc_x = ax.bbox.width / ax.viewLim.width
>        sc_y = ax.bbox.height / ax.viewLim.height
>
>        return transforms.Affine2D().scale(sc_x, sc_y)
>
> col.__class__ = RegularPolyCollection2
>
> plt.axis('equal')
> plt.show()

Thanks Jae-Joon! This is exactly what I was looking for.

-Tony

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to