0

enter image description here

Currently, the y axis value is (0, 0.05, 0.10, 0.15, 0.20...),

I want the axis value to be (0.7, 0.75, 0.80, 0.85, 0.90, ...)

How to accomplish this?

Red
  • 26,798
  • 7
  • 36
  • 58
LGDGODV
  • 263
  • 1
  • 10
  • 1
    Would this help? [Increase number of axis ticks](https://stackoverflow.com/questions/11335836/increase-number-of-axis-ticks) – Red Dec 24 '20 at 21:39
  • 1
    Use `scale_y_continuous()` and set the `breaks=` parameter to specify where you want axis labels to appear. – MrFlick Dec 24 '20 at 21:41

1 Answers1

-1

Try this defining a sequence of values inside scale_y_continuous(). Here and example using dummy data:

library(ggplot2)
#Data
df <- data.frame(Val=runif(100,0.7,1.5),
                 Group=sample(c('a','b','c'),size = 100,replace = T),
                 stringsAsFactors = F)
#Plot
ggplot(df,aes(x=Group,y=Val,color=Group))+
  geom_point()+
  scale_y_continuous(breaks = seq(0.7,1.5,by=0.05))

Output:

enter image description here

Duck
  • 39,058
  • 13
  • 42
  • 84
  • `stringsAsFactors` is no longer needed for calls to `data.frame`, as it defaults to `FALSE` in recent versions of `R`. – mhovd Dec 24 '20 at 22:14
  • scale_y_continuous(breaks=c(0,0.05,0.10,0.15,0.2)) – LDT Dec 26 '20 at 01:16