楼主: xuezhongcao
6099 16

[有偿编程] 求助日历热图calendarPlot()中显示星期 [推广有奖]

教师

教授

17%

还不是VIP/贵宾

-

威望
0
论坛币
32894 个
通用积分
5.6615
学术水平
13 点
热心指数
26 点
信用等级
15 点
经验
61603 点
帖子
956
精华
0
在线时间
1279 小时
注册时间
2007-9-15
最后登录
2023-9-3

3论坛币
在画图的过程中显示这样的图片
v2-60185f96015b2adc8b83a8b287be3e60_r.jpg
里面的星期几不显示,如何让他修改成“一、二、三、四、五、六、日”内容,采用的函数如下:
filter(data1,Year==2015)%>%calendarPlot(.,pollutant="aqit",breaks=breaks,labels=label,year=2015)
详细的可以参阅https://cosx.org/2012/05/calendarheatmap
求助大家,谢谢!

关键词:Calendar plot Alen DaR ale
沙发
xuezhongcao 在职认证  发表于 2018-2-9 19:26:41 |只看作者 |坛友微信交流群
怎么没有人帮我解释呀,谢谢

使用道具

藤椅
xuezhongcao 在职认证  发表于 2018-2-10 21:03:49 |只看作者 |坛友微信交流群
数据文件:https://pan.baidu.com/s/1d3UKP4
代码:# ####回归分析 ----------------------------------------------------------------
####回归分析
options(digits=3)

###2018年2月6日更新
data1<-read.csv("C:\\Users\\shitong\\Desktop\\2014.csv",header=T,sep=",")
###描述性统计分析
names(data1)
summary(data1)

###增加日期
# data1$day1<-paste(data1$year,"年",data1$month,"月",data1$day,"日",sep="")
data1$date<-paste(data1$year,data1$month,data1$day,sep="-")

##转化成日期格式
library(lubridate)
data1$date<-as.Date(data1$date)
# names(mytable)[c(1,3,4,11)]<-c("date","Range","Level","Order")
data1$Year<-year(data1$date)
breaks<-c(0,50,100,150,200,300,500)
label<-c("excellent","good","Mild pollution","moderate pollution","heavy pollution ","serious pollution")


# 制作天津市 2014~2016三年度历史空气质量数据年度日历热图
library(dplyr)
library(openair)
filter(data1,Year==2014)%>%calendarPlot(pollutant="aqit",breaks=breaks,labels=label)
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
浙财周大大 + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

板凳
浙财周大大 发表于 2018-3-13 21:01:07 |只看作者 |坛友微信交流群
非常感谢你的分享,为什么我还是没显示星期几呢?

使用道具

报纸
xuezhongcao 在职认证  发表于 2018-3-14 12:35:52 |只看作者 |坛友微信交流群
是这样的图

Rplot08.jpeg (45.81 KB)

Rplot08.jpeg

Rplot08.jpeg (45.81 KB)

Rplot08.jpeg

使用道具

地板
1336503640 发表于 2018-6-4 22:23:11 |只看作者 |坛友微信交流群
> ###增加日期
> # data1day1<−paste(data1year,"年",data1月month,"月",data1day,"日",sep="")
> data1date<-paste(data1$year,data1$month,data1$day,sep="-")
>
> ##转化成日期格式
> library(lubridate)
> data1date<-as.Date(data1date)
> # names(mytable)[c(1,3,4,11)]<-c("date","Range","Level","Order")
> data1Year<-year(data1date)
> breaks<-c(0,50,100,150,200,300,500)
> label<-c("excellent","good","Mild pollution","moderate pollution","heavy pollution ","serious pollution")
>
>
> # 制作天津市 2014~2016三年度历史空气质量数据年度日历热图
> library(dplyr)
> library(openair)
> filter(data1,Year==2014)%>%calendarPlot(pollutant="aqit",breaks=breaks,labels=label)
Error in filter_impl(.data, quo) :
  Evaluation error: object 'Year' not found.

使用道具

7
1336503640 发表于 2018-6-4 22:25:42 |只看作者 |坛友微信交流群
怎么我原代码复制运行报错了Error in filter_impl(.data, quo) :   Evaluation error: object 'Year' not found.

使用道具

8
1336503640 发表于 2018-6-4 22:26:23 |只看作者 |坛友微信交流群
只是最后一句报错

使用道具

9
cheetahfly 在职认证  发表于 2019-2-22 00:13:34 |只看作者 |坛友微信交流群
你打开calendarPlot的代码,其中有个weekday.abb 变量的赋值语句,你改成weekday.abb <- c("Sun", "Sat", "Mon"....)等,再运行一遍,把出错时告诉你没有的函数前面加上openair:::,运行时,先library(lattice)就可以了

使用道具

10
xuezhongcao 在职认证  发表于 2019-2-24 16:11:45 |只看作者 |坛友微信交流群
cheetahfly 发表于 2019-2-22 00:13
你打开calendarPlot的代码,其中有个weekday.abb 变量的赋值语句,你改成weekday.abb
非常感谢!

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 11:26