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

yticks.by not works with minus scale #146

Closed
biofisherman opened this issue Jan 2, 2019 · 1 comment
Closed

yticks.by not works with minus scale #146

biofisherman opened this issue Jan 2, 2019 · 1 comment

Comments

@biofisherman
Copy link

The y scale range of my dataset is (-3, 3). When I set the yticks.by = 1, only the positive scales were changed, but not the negative scales.
Now, I have to use the following code to make it work.scale_y_continuous(breaks=c(-3,-2, -1,0, 1, 2, 3))

Any suggestions?

Thanks!

@kassambara
Copy link
Owner

Should work now after the update in #258

library(ggpubr)
# Data
set.seed(123)
x <- rnorm(100)
df <- data.frame(x = x, y = 2*x )

# Default plot
ggscatter(df, "x", "y")

# Set ticks
# Use this
ggscatter(df, x = "x", y = "y", yticks.by = 1)

# Or use this
ggscatter(df, x = "x", y = "y")+
  scale_y_continuous(breaks = get_breaks(by = 1))

Created on 2020-05-08 by the reprex package (v0.3.0.9001)

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