2014-08-31 98 views
3

我现在用的是DescToolsR包的PlotCirc()功能的可视化应急表:标签旋转

library(DescTools) 

tab <- matrix(c(2,5,8,3,10,12,5,7,15), nrow=3, byrow=FALSE) 
dimnames(tab) <- list(c("ABCDEFG","BCDEFGH","CDEFGHI"), c("D","E","F")) 

PlotCirc(tab, 
      acol = c("dodgerblue","seagreen2","limegreen","olivedrab2","goldenrod2","tomato2"), 
      rcol = SetAlpha(c("red","orange","olivedrab1"), 0.5) 
) 

enter image description here

问:

哪有我旋转所有标签(左侧和右侧),以便它们从圆圈(文本基线指向圆圈中间)展开?即第一个标签“ABCDEFG”应该向上旋转几乎-90度,而“CDEFGHI”应该旋转大约45度,稍微向下一点,等等。

回答

2

我无法弄清楚如何在该软件包中完成它。但是,它仍然是可能的:

tab <- matrix(c(2,5,8,3,10,12,5,7,15), nrow=3, byrow=FALSE) 
dimnames(tab) <- list(c("A","B","C"), c("D","E","F")) 



PlotCirc(tab,labels = NA, cex.lab = 1.0,acol = c("dodgerblue","seagreen2","limegreen","olivedrab2","goldenrod2","tomato2"),rcol = SetAlpha(c("red","orange","olivedrab1"))) 



text(3,15,"ABCDEFG",srt=80) 
text(11,10,"BCDEFG",srt=40) 
text(13,-5,"CDEFG",srt=-30) 
text(-5,-12,"DEFG",srt=60) 
text(-12,-5,"EFG",srt=30) 
text(-9,11,"FG",srt=-45) 

http://i.stack.imgur.com/sK6Kr.png