水平线段

时间:2012-09-14 23:18:00

标签: r ggplot2

int_times

gene       lag     stim num
 a1  46.53000 173.5300   1
 a2 101.47000 162.5900   2
 a3  14.00000 259.0000   3
 a4   6.43276 134.1821   4
 a5  28.00000 182.0000   5
 a6  16.00000 198.0000   6

这是我的gg代码

   ggplot(int_times,aes(x=stim,y= num,colour=gene)) +
       scale_y_continuous(labels=c('should not exist',int_times$gene)) +
       # geom_line(aes(position)) +
       geom_segment(aes(xend=length(stim),yend=.01)) +
       xlab('x') +
       ylab('y') +          
       opts(title = 'Multiple Gs')    

我无法弄清楚如何让hline工作,但我希望每件事情都是现在的样子,除了每条线在它的相应y轴上是一个单独的水平线段 enter image description here

1 个答案:

答案 0 :(得分:1)

了解这对您有何帮助:

   ggplot(int_times,aes(x=stim,y=gene ,colour=gene)) +
       geom_segment(aes(xend=length(stim),ystart=gene, yend=gene)) +
       xlab('x') +
       ylab('y') +          
       opts(title = 'Multiple Gs')   

Doug我编辑并提供了y基因,因为这似乎是你想要的y轴。

相关问题