0
votes

I'd like my continuous y axis to have both labeled major ticks and minor unlabeled ticks. The reproducible code below should illustrate the problem. It seems that the minor_breaks argument within scale_y_continuous is having no effect.

data.data <- data.frame(Categorical=c("First", "Second", "Third", "Fourth"), Mean=c(25, 40, 90, 65))

ggplot(data=data.data, aes(Categorical, Mean)) +
  geom_bar(stat="identity", fill="white", width=0.75, color="black") + 
  scale_y_continuous(breaks=seq(0,100,20), minor_breaks=seq(10,100,20), limits=c(0,100), expand=c(0,0)) +
  theme(axis.title=element_text(size=12, face="italic"), 
        axis.text=element_text(size=12, face="plain"),
        axis.line=element_line(color="black", size=0.5),
        panel.grid.major.y=element_blank(),
        panel.grid.minor.y=element_blank(),
        panel.grid.major.x=element_blank(),
        panel.grid.minor.x=element_blank(),
        panel.background=element_blank())
1

1 Answers

1
votes

Sorry,

I found the solution. (There is no built-in code to do this, but by specifying the number of breaks and adding a labels argument you can create unlabeled ticks by labeling them "")