plotnine
plotnine copied to clipboard
Overwriting default_aes
For a custom theme, I'd like to change the default point color away from black. I can hack this for all coming ggplots by changing the geom_point default_aes, but I'd like to have a per plot API for this.
Any suggestions how we'd implement this? Perhaps we can get away with not having an API but using the first scale_color entry, just like we'd do if there was a mapping? (Right now the scale_color complains about not being used).
My theme set's color and fill scales anyhow.
This is a difficult issue given the current organisation but it is one I would like to have tackled before v1.0.0 (whenever that is). I have found it hard to do it without becoming "too clever". Note that themes that would specify colours for the default aesthetics of geoms would do not add that much to the user experience because default aesthetics only apply when the plot has no mappings (other than the position mappings). And when there are mappings the scales come with their own palettes. Therefore for themes to determine the appearance of what is plotted the plotnine theming system must be designed to allow themes to manage both the default aesthetics and the scales. And from your comment I think we are on the same page about this wholesomeness, but it is what makes it difficult.
Perhaps we can get away with not having an API but using the first scale_color entry
This violates the grammar, in that scales are strictly for mapped variables. Doing it that way create a bunch of special cases and it would be finicky.
I think this is a feature that gets implemented when there is mass appeal, especially if there is a popular third-party theme package that needs the feature. We could then look at the various ways the package has tried (succeeded or failed) to work around plotnine, and base our API changes on that.
Well, my big problem is that it also effects the legends. If I have shape and colour, and a dark background, you cant not read the shape legend.
I suppose I can monkey patch the default_aes in my library easy enough if my cyberpunk theme is active.
Too illustrate:

What is the problem with the shape legend.
It is black on an almost black background.