Description
This is a feature proposal, not a bug. Please let me know if this is not the right place to file it.
It seems from the matplotlib version that I am using, that the list of valid plotting options are directly declared in their respective plotter constructor, i.e. options for Line2D are directly listed in the Line2D
constructor. This makes it quite difficult for other libraries such as pandas
to easily validate and/or specify the set of valid options accepted, leading to a 'rush to args completeness' (such as in pandas.DataFrame.plot), and eventually to the 'giving up' option (the generic kwds
argument at the end of the list, containing "Options to pass to matplotlib plotting method"). Users then stop getting any help from their IDE to get a list of valid options and description.
The absence of such objects makes it also more difficult to perform higher-level automation, such as reusing the same options (or part of the same options) for several plots in a row - which is actually the use case for pandas.DataFrame.plot
.
I think that a better way exist and is quite simple to do. It would require two steps:
- for each plotter object, create an independent class containing the configuration options. For example
Line2DOptions
forLine2D
. The constructor ofLine2D
would continue to accept all keyword arguments as usual but would in addition also accept an instance ofLine2DOptions
instead. - optionally, create a parent class
PlotterOptions
for all such options class, so that it is relatively easy to both retrieve all such options, and also for other libraries such as pandas to do some basic typechecking.
Food for thoughts...