同一图形上不同行的图

时间:2023-02-03 11:48:38

I found an interesting thread about plotting but I'm not happy with the answer. I would like to plot different amount of rows on the same graph. Just giving me the possibility to add as much rows as I want to.

我发现了一个关于密谋的有趣线索,但我对这个答案并不满意。我想在同一个图上画出不同的行数。给我添加尽可能多的行的可能性。

I'd like to use glopts library but I am open for any other. First of all I want to plot those rows into pdf file. The script which I want to modify is:

我想使用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()

Can you help me to modify this script to print just all of the rows which I decide on the same graph ? Would be great if you show me how I can jsut add new page in this pdf file using the other set of rows like which_rows2.

你能帮我修改一下这个脚本以打印所有我在同一图上决定的行吗?如果您向我展示如何使用另一组行(如who_rows2)在这个pdf文件中添加新页面,那就太好了。

Of course each plot should has diffent colour or something.

当然,每一个情节都应该有不同的色彩。

Edit:

编辑:

同一图形上不同行的图

1 个解决方案

#1


2  

use points()to add points to the existing plot

使用点()添加指向现有情节的点。

#1


2  

use points()to add points to the existing plot

使用点()添加指向现有情节的点。