Implement Axes.format features with individual setters #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Starting this PR to keep #63 on everyone's radar. Along with #50 and #45 this is one of the major (but mostly internal) changes I am considering for the version 1.0 release.
ProPlot adds "batch" setter methods called
format
to everyAxes
subclass. The idea is it's quicker to call 1 method with 10 keyword arguments rather than 10 methods on 10 lines. Interestingly, it looks like the Plots.jl julia package follows a similar philosophy (see the "Lorenz attractor" example).However:
It also makes the setter methods really long and difficult to maintain.(no longer valid; see below) I want to encourage batch setting but permit individual one-liner setting if the user so chooses.Artist.set
. However nobody uses it, probably because (1) it seldom appears in the online examples and (2) the valid arguments are not explicitly documented, which is confusing for new userss.With this PR, I'd like to combine the features of
Axes.format
withArtist.update
andArtist.set
by overriding the latter for axes artists. I will deprecateformat
and break up theformat
tasks into individual setters, but encourage using the batch setters by using them in all of the examples and documenting the acceptable keyword args.Here is some pseudocode to outline the general idea.
Then to encourage using the batch setters, we can concatenate docstrings from each individual setter: