R:如何更改折线图中的绘图标题

R: how to change title of plot in lineChart

有没有一种简单的方法可以将标题设为 "General Electric" 而不是 "GE"?

chart.R

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

只需使用 name 参数

lineChart(GE, name = "General Electric")

如果有人需要使用新的 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()