Delete ticks between breaks in ggplot

Viewed 801

I'd like to create a line graph with irregular break intervals on the x-axis. When I define the breaks as in the code example, I get additional unlabeled breaks, which always seem to be exactly in the middle of two defined breaks and thus are unregular too (see image in link).

test_frame <- data.frame("v1"=1:3,"v2"=3:1)

library(ggplot2)
ggplot(data = test_frame, aes(x=v1, y=v2, group=1))+geom_line()+
scale_x_continuous(breaks = c(2.74,2.43,1.19))

Graph with additional breaks:

Graph with additional breaks

Is there any way to get rid of these vertical lines, so that there are only lines at the defined break position? I'd be grateful for any suggestions.

2 Answers
ggplot(data = test_frame, aes(x = v1, y = v2, group = 1)) +
  geom_line() +
  scale_x_continuous(breaks = c(2.74, 2.43, 1.19)) +
  theme(panel.grid.minor = element_blank()) # or panel.grid.minor.x to keep horizontal lines

enter image description here

Set minor_breaks = NULL:

scale_x_continuous(breaks = c(2.74,2.43,1.19), minor_breaks = NULL)

enter image description here

Related