You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For consistency with the matplotlib API, all of the features implemented in self.format() should be implemented with setters and getters, then the axes can be updated with nativeArtist.update or Artist.set methods. Also, Axes.format will redirect to update and issue a deprecation warning.
Here is some background:
The matplotlib API uses setters and getters for updating arbitrary abstract Artist classes, including the Axes class.
The matplotlib API also has Artist.set and Artist.update methods for bulk updating arbitrary artists. Example usage: If an artist has set_linewidth and set_linestyle methods, then update and set will accept linewidth and linestyle as keyword args and pass them to the setter.
Part of the inspiration for ProPlot was that I found line-by-line property setting to be very inefficient in day-to-day usage, and wanted one function for updating all aspects of the axes. The problems with Artist.update and Artist.set are:
(1) almost on one uses them (especially with Axes artists), (2) they appear seldom in the examples, and (3) there is no artist-specific documentation on keyword arguments accepted by these methods, since they work by searching for arbtirary setters with getattr(self, 'set_' + key), so only advanced users will learn how to use them.
I think it is important for users to be able to modify arbitrary properties of python classes in place without a "bulk" function. However, it is also important for the sake of efficiency that users have this "bulk" function, and they should be encouraged to use the "bulk" one in the first place.
Where ProPlot can improve this is by documenting the "bulk" function by scanning the Axes attributes and building a numpydoc-style parameter table from the first line of every setter, and allowing people to pass keyword args to arbitrary setters with {setting}_kw-style arguments. Every ProPlot example will still use the bulk updater to encourage this for new users.
A more bold option could be to monkey patch the matplotlib Artist class, overriding its set and update methods so that every artist is documented like this. But I think the PR will just start with axes.
The text was updated successfully, but these errors were encountered:
lukelbd
changed the title
Add setters and getters associated with all "format" features
Add setters and getters associated with all Axes.format features
Nov 10, 2019
lukelbd
changed the title
Add setters and getters associated with all Axes.format features
Consider adding setters and getters associated with all Axes.format features
Nov 16, 2019
For consistency with the matplotlib API, all of the features implemented in
self.format()
should be implemented with setters and getters, then the axes can be updated with nativeArtist.update
orArtist.set
methods. Also,Axes.format
will redirect toupdate
and issue a deprecation warning.Here is some background:
Artist
classes, including theAxes
class.Artist.set
andArtist.update
methods for bulk updating arbitrary artists. Example usage: If an artist hasset_linewidth
andset_linestyle
methods, thenupdate
andset
will acceptlinewidth
andlinestyle
as keyword args and pass them to the setter.Artist.update
andArtist.set
are:(1) almost on one uses them (especially with
Axes
artists), (2) they appear seldom in the examples, and (3) there is no artist-specific documentation on keyword arguments accepted by these methods, since they work by searching for arbtirary setters withgetattr(self, 'set_' + key)
, so only advanced users will learn how to use them.I think it is important for users to be able to modify arbitrary properties of python classes in place without a "bulk" function. However, it is also important for the sake of efficiency that users have this "bulk" function, and they should be encouraged to use the "bulk" one in the first place.
Where ProPlot can improve this is by documenting the "bulk" function by scanning the
Axes
attributes and building a numpydoc-style parameter table from the first line of every setter, and allowing people to pass keyword args to arbitrary setters with{setting}_kw
-style arguments. Every ProPlot example will still use the bulk updater to encourage this for new users.A more bold option could be to monkey patch the matplotlib
Artist
class, overriding itsset
andupdate
methods so that every artist is documented like this. But I think the PR will just start with axes.The text was updated successfully, but these errors were encountered: