You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

R语言3D绘图:perspbox坐标轴拉伸解决刻度拥挤问题

求助:解决3D图形坐标轴刻度拥挤问题

我正在为课程项目复现一篇论文中的3D图形,此前已获取到绘图方法的相关帮助,但仍无法通过拉伸坐标轴解决刻度值拥挤的问题(见下方原图)。

坐标轴刻度拥挤的3D图

使用的代码如下:

library(plot3D)
par(mar=c(1,1,1,1))

R_0 <- function(beta_s, gamma_a, alpha_a = 0.4775, alpha_u = 0.695,
                mu = 0.062, q_i = 0.078, eta_i = 0.009, eta_u = 0.05) {
  
  A <- beta_s * alpha_a / (gamma_a + mu) 
  B <- beta_s * alpha_u * gamma_a * (1 - q_i) / ((gamma_a + mu) * (eta_u + mu))
  A + B
}

beta <- gamma <- seq(0, 0.4, length.out = 100)

R <- outer(beta, gamma, R_0)

#Adding an empty perspbox

perspbox(beta, gamma, z = R, theta = -50, ticktype = "detailed",
         col.grid = "gray85", bty = "u",
         xlab = "βₛ", ylab = "γₐ")

pp <- persp3D(beta, gamma, z = R, theta = -50, add = TRUE)

#Horizontal plane-adding function

plane3D <- function(z, 
                    col = adjustcolor("blue", alpha.f = 0.2),
                    border = NA,
                    xlim = c(0,0.4), ylim = c(0, 0.4)) {
  dd <- expand.grid(x=xlim, y = ylim, z= z)
  rr <- with(dd, trans3D(x,y,z,pp))
  perm <- c(1,3,4,2)
  polygon(rr$x[perm], rr$y[perm], col = col, border = border)
}

#Adding planes

plane3D(1)
plane3D(2, col = adjustcolor("red", alpha.f = 0.2))

基于dcarlson的修改后的图形如下:

修改后的3D图

恳请各位提供相关帮助,非常感谢!

内容的提问来源于stack exchange,提问作者Hew123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 16:30:59