From: Benjamin R. <ben...@ou...> - 2010-08-27 15:04:38
|
On Thu, Aug 26, 2010 at 2:24 PM, Ben Edwards <bed...@cs...> wrote: > Hello, I've used matplotlib for a while but never had cause to ask a > question until now. I am trying to add a patch to an axis, but would like > the patch to remain the same size when, interactively, I resize the > resulting figure. I am using TkAgg, and trying the following: > > >>> import matplotlib.pyplot as plt > >>> import matplotlib.patches as patches > >>> ax = plt.gca() > >>> cp = patches.Circle((.5,.5),.025) > >>> ax.add_patch(cp) > >>> ax.set_aspect('equal') > >>> plt.draw() > >>> plt.show() > > This gives me a nice blue circle in the middle of the plot, and using > ax.set_aspect('equal') I know that it will not be distorted into an ellipse. > But is there a way to ensure that when I make the Tk window bigger, that the > circle appears to be the same size as it was previously? I assume this would > entail some sort of transform, but I don't quite understand how they work... > > Ben > > I haven't tried using this tool myself, and it might not be what you want, but there is an AnchoredArtist tool that might interest you: http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#anchoredartists I think this means that it wouldn't move at all, and I don't know if that is what you want. I hope this helps! Ben Root |