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

Unable to change the color of axis.line #62

Closed
FrankFromGermany opened this issue Mar 5, 2017 · 4 comments
Closed

Unable to change the color of axis.line #62

FrankFromGermany opened this issue Mar 5, 2017 · 4 comments

Comments

@FrankFromGermany
Copy link

I've just started to use ggplot2 and cowplot so I might be wrong.

For some reason the color of the axis.line element cannot be changed.
I can change the color of other elements, even axis.ticks.

@clauswilke
Copy link
Contributor

Please provide a minimal, reproducible example of the problem.

@clauswilke
Copy link
Contributor

You need to change axis.line.x and axis.line.y.

@FrankFromGermany
Copy link
Author

@clauswilke
using axis.line.x and axis.line.y does work. I tried the following, which is in line with ggplot, but does not work:

library(cowplot)
p <- ggplot(mpg, aes(hwy, cty, color = factor(cyl))) +
geom_point(size = 2.5) +
theme(axis.line = element_line(color = "red", linetype = "dotted"))
p

@clauswilke
Copy link
Contributor

If a theme changes a derived property (e.g. axis.line.x) then changing the parent property has no effect. It's a well-known issue in ggplot2 that has caused some confusing effects, e.g. tidyverse/ggplot2#2058.

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

2 participants