小编use*_*004的帖子

圆形热图,看起来像甜甜圈

我正在尝试用ggplot2创建圆形热图,这样我就可以在圆周上使用更多的标签.我想让它看起来更像是一个中间有空洞的甜甜圈,但同时不会丢失任何行(它们需要压缩).

我的代码如下.

library(reshape)
library(ggplot2)

nba <- read.csv("http://datasets.flowingdata.com/ppg2008.csv")

nba$Name <- with(nba, reorder(Name, PTS))
nba.m <- melt(nba)
nba.m <- ddply(nba.m, .(variable), transform, value = scale(value))


p = ggplot(nba.m, aes(Name,variable)) + geom_tile(aes(fill = value), colour = "white") +           scale_fill_gradient(low = "white", high = "steelblue") 
p<-p+opts(
panel.background=theme_blank(),
axis.title.x=theme_blank(),
axis.title.y=theme_blank(),
panel.grid.major=theme_blank(),
panel.grid.minor=theme_blank(),  
axis.text.x=theme_blank(),
axis.ticks=theme_blank()
)


p = p + coord_polar() 
plot(p) 
Run Code Online (Sandbox Code Playgroud)

r heatmap ggplot2 donut-chart

32
推荐指数
1
解决办法
6231
查看次数

标签 统计

donut-chart ×1

ggplot2 ×1

heatmap ×1

r ×1