【问题标题】:R: Line Plot for each Signal (Elements) in a List as PDFR:PDF 列表中每个信号(元素)的线图
【发布时间】:2021-06-04 13:45:55
【问题描述】:

我目前正在处理呼吸数据(N = 97 个信号),这些数据都存储在一个列表中。列表中的每个元素代表一个信号。

示例列表结构:

S1 = rep(1:10000, 1)
S2 = rep(1:15000, 1.5)
S3 = rep(1:25000, 0.5)

List1 = list(S1, S2, S3)

对于数据的可视化检查,我需要一个函数,它为每个呼吸信号创建一个简单的折线图,并将结果存储在一个大的 PDF 文件中。理想情况下,列表中每个元素的名称都会成为相应图表的标题,而我每页只有 1-3 个图表。

不幸的是,我什至没有接近可行的解决方案。如有任何帮助或提示,我将不胜感激!

【问题讨论】:

    标签: r list pdf plot signals


    【解决方案1】:
    pfad.plot <- "/Users/.../" #directory where you want the pdf to be safed
    
    pdf(file = paste0(pfad.plot, "test.pdf"),
        width = 12, height = 9, onefile = TRUE, family = "Helvetica",
        fonts = NULL, version = "1.2",
        pointsize=14) #open line to pdf
    
    par(mfrow = c(3,1))
    #par sets all different graphical parameters 
    #mfrow gives the number of colums, number of rows
    
    plot(List1[[1]]) #S1 from list
    plot(S2) #S2 directly
    
    dev.off() #important to close the open line to the pdf
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-08
      • 2021-03-21
      • 2022-07-25
      • 2023-03-19
      • 2014-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多