Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Reverse" implementation #68

Open
eliocamp opened this issue Jul 18, 2024 · 1 comment
Open

"Reverse" implementation #68

eliocamp opened this issue Jul 18, 2024 · 1 comment

Comments

@eliocamp
Copy link
Owner

Currently ggnewscale modifies all previous layers when a new_scale() is added. This means that new scales modify existing scales, making it hard to know the name of the new scales programmatically and also leading to a weird parity error. It also means I cannot add the ability of renaming aes to a particular string ala relayer.

An alternative implementation would change only the subsequent layers and don't touch the existing ones. Because the subsequent layers do not exist when new_scale() is added, then the implementation would "mark" a plot with a custom class with its custom + method and then modify layers as they are added.

I've been experimenting with this in the "reverse-internals" branch (e.g. e91f6d5).

@eliocamp
Copy link
Owner Author

A big issue is that if the user doesn't add a layer explicitly after new_scale() then ggplot2 cannot find the correct scale (it will be looking for a scale_colour_new_continuous() or something like that. A solution would be to add the scale if needed when adding the layer, but it's not trivial to guess the type of scale that is needed. This is not a problem in the other implementation because I can build the plot and extract the relevant scale easily.

I'm not sure how to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant