2014-09-30 70 views
3

我发现了一个关于绘图的有趣线索,但我并不满意答案。我想在同一个图上绘制不同数量的行。只要给我可以添加尽可能多的行就可以了。同一张图上的不同行的图

我想使用glopts库,但我是开放的任何其他。首先,我想将这些行绘制成pdf文件。我想修改的脚本是:

which_rows <- c(12,156,4432) ## I want to choose which row I want to plot 

pdf(file='Plots'.pdf) 

x <- 1:(ncol(data_plot)-1) ## Can it be changed to use the name of the columns instead of pure numbers ? 

for(i in which_rows){ 
## create new pdf page BUT I WANT TO PLOT IT ON THE SAME GRAPH! 
    plot(x=x,y=data_plot[i,-1],type='b',main=data_plot[i,1],xlab='columns',ylab='Intensity') 
} 

# closing pdf 
dev.off() 

你能帮我修改这个脚本来打印我在同一个图上决定的所有行吗?如果你告诉我如何使用另一组行如which_rows2来添加这个pdf文件中的新页面,那将会很棒。

当然,每个情节应该有不同的颜色或东西。

编辑:

Just one of the plots from my data. I want different colours and plots on the same graph

+1

请张贴的示例图表。我不知道你是否想要一个图形网格,一个多页输出或什么。 – 2014-09-30 12:40:40

+0

已添加,想要将我的数据中的列数更改为它们的名称。 – Rechlay 2014-09-30 12:49:13

回答

2

使用points()把点添加到现有的情节

相关问题