【问题标题】:Adding a title to R openair timeplot为 R openair timeplot 添加标题
【发布时间】:2016-10-04 20:02:28
【问题描述】:

我正在使用 R 的 openair 包来绘制超过一百个 .csv 文件的时间序列。我可以生成情节,但无法为情节添加标题。此外,我希望标题是可以从文件名或 .csv 文件的第一列中提取的站点位置。看起来你可以使用 timeplot 函数的 auto.text 来做到这一点,但我没有任何运气。是否可以在时尚中添加标题?如果可以,怎么做?

library(openair)

filedir <- "C:/Users/dfmcg/Documents/Thesis files/ALL_GPMP_O3_Met"
myfiles <- c(list.files(path = filedir))
paste(filedir, myfiles,sep = '/')
npsfiles <- c(paste(filedir, myfiles,sep = '/'))

for (i in npsfiles[1:3]){
  timeozone <- import(i, date="DATE", date.format = "%m/%d/%Y %H", header = TRUE,
                      na.strings = "-999", auto.text(main = ("ABBR")))
  timePlot(timeozone, pollutant = c("O3"))
}

这里是一小部分数据:

ABBR     DATE          O3   SWS  VWS  SWD  VWD 
ZION-DW 01/01/2004 00 -999 -999 -999 -999 -999 
ZION-DW 01/01/2004 01 -999 -999 -999 -999 -999

【问题讨论】:

    标签: r csv plot


    【解决方案1】:

    您想将 timePlot 的主要属性与您的站点位置一起用作它的字符串选项。

    title = 'Site location'
    timePlot(mydata, pollutant = "nox", main = title)
    

    【讨论】:

    • 这在我的图表上放置了一个标题,原因是没有成功循环浏览我的文件并添加适当的标题。不过,它有助于弄清楚下一步该去哪里。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2018-08-10
    • 2013-02-19
    • 1970-01-01
    • 2019-09-12
    • 2021-10-17
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    相关资源
    最近更新 更多