删除记号标记,但保留轴标签ggplot2 R

删除记号标记,但保留轴标签ggplot2 R,r,ggplot2,R,Ggplot2,假设我有以下data.frame: structure(list(x = c("item_1", "item_2", "item_3", "item_4"), y = c("location_1", "location_2", "location_3", "location_4" )), clas

假设我有以下data.frame:

    structure(list(x = c("item_1", "item_2", "item_3", "item_4"), 
        y = c("location_1", "location_2", "location_3", "location_4"
        )), class = "data.frame", row.names = c(NA, -4L))

########################
#       x          y
#1 item_1 location_1
#2 item_2 location_2
#3 item_3 location_3
#4 item_4 location_4
使用以下绘图:

data %>% ggplot(aes(x,y)) + geom_point()


是否有办法将所有四个标签保持在y轴上,但只显示位置_4和位置_1的记号?

是。主题元素
axis.ticks.y
将采用矢量化颜色

数据%>%
ggplot(aes(x,y))+
几何点()+
主题(axis.ticks.y=元素线(颜色=c(“黑色”,NA,NA,“黑色”)),
axis.ticks.length=单位(5,“点”))

艾伦,你是最棒的!我甚至没有想过要改变颜色。谢谢