image.png
我选择使用R语言的ggplot2来实现,这个是箱线图和热图的拼接,右侧的热图可以借助geom_point()函数实现,将点的形状改为正方块,数值按照正负来映射颜色,按照一定的数值来映射大小...image.png
正常做一个柱形图
library(ggplot2)
ggplot(data=df,aes(x=x,y=y))+
geom_col(aes(fill=x))
?...image.png
拉大图例与主图的距离
使用theme()函数中的legend.box.margin参数来调节
ggplot(data=df,aes(x=x,y=y))+
geom_col(aes...image.png
将图例放到右上角
通过 legend.justification 参数来实现
ggplot(data=df,aes(x=x,y=y))+
geom_col(aes(fill=x)...df,aes(x=x,y=y))+
geom_col(aes(fill=x))+
theme(legend.box.margin = margin(0,0,0,5,unit = 'cm'),