楼主: windspeedo
3161 1

[求助]请教trellisPlot.timeSeries如何画点。 [推广有奖]

  • 0关注
  • 0粉丝

已卖:162份资源

初中生

0%

还不是VIP/贵宾

-

威望
0
论坛币
845 个
通用积分
0.1200
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
147 点
帖子
11
精华
0
在线时间
1 小时
注册时间
2008-8-19
最后登录
2016-7-2

楼主
windspeedo 发表于 2008-8-22 21:42:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

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编辑过]

二维码

扫码加我 拉你入群

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

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

关键词:trellisPlot timeseries Trellis Series Times 求助 请教 timeseries trellisPlot

沙发
DM小菜鸟 发表于 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', ...)
           })


您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-24 18:48