position_dodge
,但与
geom_linerange
ggplot(dt1, aes(x=start, y=subject)) +
geom_linerange(data = dt1[type %in% c('U', 'D')],
aes(xmin=start,xmax=stop, color = type),
size=3, alpha=0.5, position = position_dodge(width = 0.2))+
scale_color_manual(values = c('red', 'blue')) +
geom_point(data = dt1[type=='pnt',])
geom_segment
位置\u闪避
ggplot(dt1, aes(x=start, y=subject)) +
geom_segment(data = dt1[type %in% c('U', 'D')],
aes(xend=stop,yend=subject, color = type),
size=3, alpha=0.5, position = position_dodge(width = 0.2))+
scale_color_manual(values = c('red', 'blue')) +
geom_point(data = dt1[type=='pnt',])