gpt4 book ai didi

r - PlotCirc 中的标签旋转(DescTools 包)

转载 作者:行者123 更新时间:2023-12-04 12:43:25 27 4
gpt4 key购买 nike

我正在使用 DescToolsPlotCirc() 函数R可视化列联表的包:

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

问题:

如何旋转所有标签(左侧和右侧),以便它们从圆(文本基线指向圆的中间)展开? IE。第一个标签“ABCDEFG”应该旋转近 -90 度,指向上方,而“CDEFGHI”应该旋转大约 45 度,指向下方,依此类推。

最佳答案

我不知道如何在那个包中做到这一点。然而,它仍然是可能的:

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

关于r - PlotCirc 中的标签旋转(DescTools 包),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25591276/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com