【问题标题】:R: how to change title of plot in lineChartR:如何更改 lineChart 中的绘图标题
【发布时间】:2017-11-05 21:32:56
【问题描述】:

有没有一种简单的方法可以将标题改为“通用电气”而不是“通用电气”?

chart.R

library(quantmod)
getSymbols("GE")
lineChart(GE)

【问题讨论】:

    标签: r charts quantmod


    【解决方案1】:

    只需使用name 参数

    lineChart(GE, name = "General Electric")
    

    【讨论】:

      【解决方案2】:

      如果有人需要使用 new chart_Series(),这是一个完整的示例。

      # create a pdf with titles
      # R --silent --vanilla < c.r
      suppressWarnings(suppressMessages(library(quantmod)))
      options("getSymbols.warning4.0"=FALSE)
      options("getSymbols.yahoo.warning"=FALSE)
      
      # list of stocks
      s= c("IBM", "AAPL", "GE", "GM")
      # get symbols from yahoo
      symbols <- list (getSymbols(s, source = "yahoo"))
      
      # create a PDF
      pdf(file = "out.pdf")
      par(mfrow = c( 4, 2 ) )
      chart_Series(IBM, name="IBM")
      chart_Series(AAPL, name="Apple")
      chart_Series(GE, name="General Electric")
      chart_Series(GM, name="General Motors")
      dev.off()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-02-13
        • 1970-01-01
        • 2019-01-01
        • 2020-09-02
        • 2016-02-13
        • 1970-01-01
        • 2011-06-08
        • 2022-10-17
        相关资源
        最近更新 更多