【问题标题】:Plots of different rows on the same graph在同一图表上绘制不同行的图
【发布时间】:2014-09-30 12:32:55
【问题描述】:

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

我想使用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 文件中添加新页面,那就太好了。

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

编辑:

【问题讨论】:

  • 请发布示例图。我不知道你是想要图表网格、多页输出还是什么。
  • 已添加,想将我的数据中的列数更改为它们的名称。

标签: r plot


【解决方案1】:

使用points()向现有绘图添加点

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多