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

compare_areas(): scale_fill name in labs() #16

Closed
oloverm opened this issue Nov 27, 2019 · 3 comments
Closed

compare_areas(): scale_fill name in labs() #16

oloverm opened this issue Nov 27, 2019 · 3 comments

Comments

@oloverm
Copy link

@oloverm oloverm commented Nov 27, 2019

compare_areas() hard-codes the fill legend title as "Area compared to Benchmark":

https://github.com/PublicHealthEngland/fingertipscharts/blob/master/R/quick_charts.R#L137

I'd prefer to have it say "Area compared to England". Because the name is defined within scale_fill_phe(), you can't overwrite it without replacing the whole scale. If it were defined in labs() instead, that wouldn't be a problem. For example:

        if (!missing(fill)) {
                fill <- enquo(fill)
                compare_areas <- compare_areas +
                        geom_col(aes_string(fill = quo_text(fill))) +
                        scale_fill_phe(theme = "fingertips") +
                        labs(fill = "Area compared to Benchmark")
        }

I've noticed names defined in the scale functions elsewhere too, which could probably all be moved into labs(), but it's only been a problem for me with compare_areas().

sebastian-fox added a commit that referenced this issue Nov 28, 2019
@sebastian-fox
Copy link
Collaborator

@sebastian-fox sebastian-fox commented Nov 28, 2019

Hi @cucumberry - thanks for reporting this. I've updated the package for both this function and the map function. they are available in the dev version of the package. If you're happy with the changes, please could you close this issue?

devtools::install_github("PublicHealthEngland/fingertipscharts",
                         build_vignettes = TRUE)
@sebastian-fox
Copy link
Collaborator

@sebastian-fox sebastian-fox commented Nov 28, 2019

ps: I didn't realise you could name legends in the labs() function - thanks for the tip

@oloverm
Copy link
Author

@oloverm oloverm commented Nov 28, 2019

Thanks Seb, yes it seems to work right

@oloverm oloverm closed this Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.