R:如何在lineChart中更改剧情的标题

时间:2017-11-05 21:32:56

标签: r charts quantmod

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

chart.R

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

2 个答案:

答案 0 :(得分:1)

只需使用name参数

即可
lineChart(GE, name = "General Electric")

答案 1 :(得分:0)

这是一个完整的示例,如果有人使用新的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()
相关问题