Pierre GM wrote: > On Jun 23, 2009, at 6:01 PM, Jeff Whitaker wrote: > >> Pierre: Doing what you suggest (having Basemap.__init__ >> automatically set self.ax to the current axes) will break pickling, >> so I can't do that. >> > > Oh, I'm sorry for the misunderstanding: I never suggested that > Basemap.ax should be set at creation (apart from Basemap.ax=None). > Instead, I suggested that it would be set when a drawing method is > called that requires access to the underlying Axes (basically, all the > plotting methods). > That way, as soon as something is plotted, we associate the basemap > instance with one particular Axes instance and we stick to it by > default. We can always break the link by changing basemap.ax (that is, > associate to another Axes instance), but we don't have the surprise > of using the last Axes instance by default. >
OK, Pierre. Now I understand. That sounds reasonable, and I don't think it will break any existing code. > Now, the more I think about it, the more I'd prefer to separate > Basemaps from Axes. Right now, self.ax assures the connection in a way > I find frustrating. I'd prefer getting rid of Basemap.ax and force > 'ax' to be defined all the time. > Don't exactly know what you mean here - make the ax keyword to the drawing methods mandatory? > Alternatively, we could consider having 2 separate objects: a > Basemap that stores all the projection information but has *NO* > plotting methods, and a MapAxes that inherits from Axes and requires a > specific Basemap attribute at creation. The current plotting routines > would be associated with the MapAxes object. > Hmm. I see how this could work, but what would be the added benefit (beyond what we would get by implementing your first suggestion)? -Jeff ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users