全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3163 1
2008-08-22

trellisPlot.timeSeries中的参数plot.type 可以设置画出什么样的图形。

a character string indicating the type of plot. Possible values are "line", "hloc", and "stackbar" for plotting lines/points, high-low-open-close bars, and stacked bars respectively.

现在的问题是,trellisPlot.timeSeries(x,y,...),如何才能x画出points而y画line呢?

多谢。

[此贴子已经被作者于2008-8-22 21:59:36编辑过]

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-12-28 21:32:11

st <- as.Date("2009-1-1")
en <- as.Date("2011-12-28")
date1 <- seq(st, en, "1 day")
avgtm <- round (rnorm (length(date1), 50,5), 1)
maxtm <- round (avgtm + 8 + abs(rnorm (length (avgtm),0, 1)),1)
mintm <-  round (avgtm - 8 + abs(rnorm (length(avgtm), 0, 1)), 1)
myd <- data.frame(date1, maxtm, mintm, avgtm)

# extract month
month <- function(x)format(x, '%m')
year <- function(x)format(x, '%Y')

require(lattice)
require(latticeExtra)


xyplot(avgtm ~ date1 | year(date1), data=myd,
       type='l', layout=c(1, 3),
      scales=list(x=list(relation='free')),
       xlab='', ylab='',
       panel=function(x, y, ...){
           panel.xblocks(x,month,
                        col = c("lightblue","lightgreen"),
                        border = "darkgray")
           panel.xyplot(x,y, lwd = 1, col='red', ...)
           })


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群