Plotrix标签,调整大小/字体/位置?
我一直在尝试使用plotly创建一个风险雷达,现在使用plotrix,我遇到了两者的局限性(基于我的需要和我的R技能) 对于plotly,我几乎拥有了我想要的大部分东西,除了交易破坏者无法标记径向轴(团队A、团队B等) 我使用plotrix的版本几乎就是我需要的地方,只是需要一些指导来让我越过这条线 我有4个问题:Plotrix标签,调整大小/字体/位置?,r,plotrix,R,Plotrix,我一直在尝试使用plotly创建一个风险雷达,现在使用plotrix,我遇到了两者的局限性(基于我的需要和我的R技能) 对于plotly,我几乎拥有了我想要的大部分东西,除了交易破坏者无法标记径向轴(团队A、团队B等) 我使用plotrix的版本几乎就是我需要的地方,只是需要一些指导来让我越过这条线 我有4个问题: 标题可以移到左边还是右边 放射线?标签正在流入图表圈,这使它变得很难 阅读时,它们可以调整吗 是否可以更改标签0/30/60/90/180的字体(大小和/或颜色) 在我的例子中,是否
库(plotrix)
#构建示例数据集
aRiskID您应该查看函数radial.plot.labels
和radial.grid
# plot the chart
radial.plot(myRisks$RiskDays,
myRisks$Theta,
start = pi/2,
clockwise = FALSE,
# start=pi/2,clockwise=TRUE,
show.grid.labels=1,
rp.type="s",
# main="Risk Radar",
radial.lim=c(0,30,60,90,180),
radial.labels = '',
radlab = TRUE,
point.symbols=17,
point.col=colors_plot,
cex = 2,
cex.axis = 0.25,
cex.lab = 0.25,
lwd=par("lwd"),mar=c(2,2,3,2),
# show.centroid=TRUE,
labels=NULL, label.pos = pi / 4 * 2:9)
# 1
mtext("Risk Radar", at = par('usr')[1], font = 2)
# 2
at <- c(0,30,60,90,180)
radial.plot.labels(max(at) + 35, pi / 4 * 2:9, labels = myLabels, radial.lim = at)
# 3
radial.plot.labels(at, pi / 2 * 3, labels = at, col = 1:5, cex = 1.5)
# 4
radial.plot.labels(myRisks$RiskDays, myRisks$Theta, start = pi/2,
clockwise = FALSE, labels = myRisks$RiskID)
我不小心做了一片可爱的雪花:
噢,天哪,这真是太棒了!我一直在尝试很多方法来达到我的最终目标,我已经浪费了20多个小时跌跌撞撞地通过了,我花了一半以上的时间在精心尝试,并且非常接近。我只需要找出如何减少30/60/90的字体大小,我会有我的图表!!!非常感谢你向我指出这一点。。。刚刚注意到上次声明中的cex参数;很有魅力
# plot the chart
radial.plot(myRisks$RiskDays,
myRisks$Theta,
start = pi/2,
clockwise = FALSE,
# start=pi/2,clockwise=TRUE,
show.grid.labels=1,
rp.type="s",
# main="Risk Radar",
radial.lim=c(0,30,60,90,180),
radial.labels = '',
radlab = TRUE,
point.symbols=17,
point.col=colors_plot,
cex = 2,
cex.axis = 0.25,
cex.lab = 0.25,
lwd=par("lwd"),mar=c(2,2,3,2),
# show.centroid=TRUE,
labels=NULL, label.pos = pi / 4 * 2:9)
# 1
mtext("Risk Radar", at = par('usr')[1], font = 2)
# 2
at <- c(0,30,60,90,180)
radial.plot.labels(max(at) + 35, pi / 4 * 2:9, labels = myLabels, radial.lim = at)
# 3
radial.plot.labels(at, pi / 2 * 3, labels = at, col = 1:5, cex = 1.5)
# 4
radial.plot.labels(myRisks$RiskDays, myRisks$Theta, start = pi/2,
clockwise = FALSE, labels = myRisks$RiskID)
th <- pi / 4 * 2:9
sapply(seq_along(th), function(ii) {
i <- ifelse((th[ii] > pi / 2) & (th[ii] < pi / 2 * 3), pi, 0)
radial.plot.labels(max(at) + 35, th[ii], labels = myLabels[ii],
radial.lim = at, srt = (th[ii] - i) * 180 / pi)
})
th <- pi / 4 * 2:9
sapply(th, function(x)
radial.plot.labels(max(at) + 35, pi / 4 * 2:9, labels = myLabels,
radial.lim = at, srt = x * 180 / pi))