From: John H. <jdh...@ac...> - 2005-01-21 03:31:54
|
>>>>> "Simon" == Simon Burton <si...@ar...> writes: Simon> add/remove methods ? Or is the (recently changed) Simon> collections attribute the Right Way (TM) to do this kind of Simon> thing ? Yes, I you're doing it the right way. I decided to make these attributes "public" when working on the figures for the "Matplotlib API" chapter of the users guide, eg Figure 7.4, which shows the Artist containment hierarchy and the respective attribute names. http://matplotlib.sourceforge.net/users_guide_0.70.pdf I've historically been reluctant to publicize the API in order to leave wiggle room for refactoring the internals, but now I'm reasonably satisfied and the API has been mostly stable for several releases. The choice to remove the underscore on these attribute names was an unheralded decision that the basic API / containment hierarchy is stable for the foreseeable future. You can safely use the list remove method w/o breaking anything. If you want to manually add an artist to the Axes, you should use the Axes add_patch, add_line, add_collection, etc, methods rather than the list append method, unless you really know what you are doing. These add_* methods set some default attributes of the artist, eg they call the set_figure, set_transform, and update the data limits for viewport autoscaling. So you either need to use the add_* methods to add artists or call these methods yourself. JDH |