重新缩放热图

我使用ggplot软件包的geom_tile生成了一个热图:

plot<-ggplot(melted_activities,aes(x=X1,y=value,group=X2)) + geom_area(position='identity',aes(fill=X2),alpha=0) + geom_line(aes(color=X2)) + labs(x="Time (hours)",y="Value(kW_Raw_data)",title="")+theme_bw() 
plot+ theme(axis.text.x = element_text(angle = 90,hjust = 1)) +  scale_x_discrete(breaks = c( "04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00","00:00","01:00","02:00","03:00"),expand = c(0,0)) +scale_y_continuous(expand=c(0,0))

重新缩放热图

现在我想减少热图的比例吗?这与标准化有关吗?

我该如何实现?

melted_activities数据帧由3列组成:

  X1(Time): 04:00-03:35
    X2(activities): 44
    value =[0-136480]

数据:

dput(head(melted_activities,10))
structure(list(X1 = structure(25:34,.Label = c("00:00","00:10","00:20","00:30","00:40","00:50","01:10","01:20","01:30","01:40","01:50","02:10","02:20","02:30","02:40","02:50","03:00","03:10","03:20","03:30","03:40","03:50","04:00","04:10","04:20","04:30","04:40","04:50","05:10","05:20","05:30","05:40","05:50","06:10","06:20","06:30","06:40","06:50","07:10","07:20","07:30","07:40","07:50","08:10","08:20","08:30","08:40","08:50","09:10","09:20","09:30","09:40","09:50","10:10","10:20","10:30","10:40","10:50","11:10","11:20","11:30","11:40","11:50","12:10","12:20","12:30","12:40","12:50","13:10","13:20","13:30","13:40","13:50","14:10","14:20","14:30","14:40","14:50","15:10","15:20","15:30","15:40","15:50","16:10","16:20","16:30","16:40","16:50","17:10","17:20","17:30","17:40","17:50","18:10","18:20","18:30","18:40","18:50","19:10","19:20","19:30","19:40","19:50","20:10","20:20","20:30","20:40","20:50","21:10","21:20","21:30","21:40","21:50","22:10","22:20","22:30","22:40","22:50","23:10","23:20","23:30","23:40","23:50"),class = "factor"),X2 = structure(c(25L,25L,25L),.Label = c("activites related to employment","Arts and hobbies","Childcare of own household member","Computing","Construction and repairs","Eating","Employment","Entertainment and culture","Food management","Free time study","Gardening and pet care","Help to an adult household member","Hobbies,games and computing","House and family care","Household maintenance","Household management","Informal help to others","Main job","Making care for textiles","Mass media","Organisational work","Other personal care","Participatory activties","PC Games","Personal care","Physical exercise","Productive exercise","Punctuating activity","Radio and music","Reading","Resting","School or University","Second job","Shopping and services","Sleep","Social care","Social life","Sport and outdoor activities","Sportsrelated activities","Study","Travel and unspecified time use","Travel by purpose","Tv and video","Volunteer work and meeting"
),value = c(1,1,1),value_scaled = structure(c(-0.326209785008489,-0.326209785008489,-0.326209785008489),.Dim = c(10L,1L
    ))),row.names = c(NA,10L),class = "data.frame")
heyan602 回答:重新缩放热图

标准化值变量:

melted_Activities

本文链接:https://www.f2er.com/3074452.html

大家都在问