用此代码绘制热图
在“温度[F]”标度的情况下,如何使用“体积”。
库(ggplot2)
图书馆
theme_set(theme_ridges())
ggplot(
测试数据,
aes(x =日期,y =音量)
)+
geom_density_ridges_gradient(
aes(填充= ..x ..),比例= 3,尺寸= 0.3
)+
scale_fill_gradientn(
颜色= c(“#0D0887FF”,“#CC4678FF”,“#F0F921FF”),
名称=“温度[F]”
)+
实验室(title ='林肯NE的温度')
这里的示例数据
test_data <-data.frame(日期= c(2009,2009,2009,2010,2010,2010,2011,2011,2011,2012,2012,2012,2013,2013,2013,2014,2014,2014,2015,2015,2015 (2015,2016,2016,2016,2017,2017,2017,2018,2018,2018),
名称= c(“ yahoo”,“ google”,“ amazon”,“ yahoo”,“ google”,“ amazon”,“ yahoo”,“ google”,“ amazon”,“ yahoo”,“ google”,“ amazon” “,” yahoo“,” google“,” amazon“,” yahoo“,” google“,” amazon“,” yahoo“,” google“,” amazon“,” yahoo“,” google“,” amazon“, “ yahoo”,“ google”,“ amazon”,“ yahoo”,“ google”,“ amazon”),
体积= c(0,0,1,0,0,0,0,0,0,1,0,2,3,3,0,1,3,1,2,3,2,5,3, 3,6,6,6,11,3,10))