0
我想創建中的R的曲線圖看起來像這樣: 三軸比圖,即旋轉軸
這是一個所謂的三軸比圖顯示的植物養分含量比率。它需要一個從0.01到100的日誌範圍,軸交叉在1.我在這個頁面上找到了兩個腳本,但是,他們有另一個目的,並不真正適合我的需要。這裏是一個:
get.coords <- function(a, d, x0, y0) {
a <- ifelse(a <= 90,90 - a, 450 - a)
data.frame(x = x0 + d * cos(a/180 * pi),
y = y0+ d * sin(a/180 * pi))
}
rotatedAxis <- function(x0, y0, a, d, symmetrical=FALSE, tickdist,
ticklen,...) {
if(isTRUE(symmetrical)) {
axends <- get.coords(c(a, a + 180), d, x0, y0)
tick.d <- c(seq(0, d, tickdist), seq(-tickdist, -d, -tickdist))
} else {
axends <- rbind(get.coords(a, d, x0, y0), c(x0, y0))
tick.d <- seq(0, d, tickdist)
}
invisible(lapply(apply(get.coords(a, d=tick.d, x0, y0), 1, function(x) {
get.coords(a + 90, c(-ticklen, ticklen), x[1], x[2])
}), function(x) lines(x$x, x$y, ...)))
lines(axends$x, axends$y, ...)
}
plot.new()
plot.window(xlim=c(-70, 70), ylim=c(-70, 70), asp=1)
# Plot the rotated axes -original
rotatedAxis(0, 0, a=60, d=60,symmetrical=TRUE, tickdist=10, ticklen=1)
rotatedAxis(0, 0, a=120, d=60, symmetrical=TRUE, tickdist=10, ticklen=1)
rotatedAxis(0, 0, a=180, d=60, symmetrical=TRUE, tickdist=10, ticklen=1)
# Add text labels to circumference -original
text.coords <- get.coords(seq(0, 300, 60), 65, 0, 0)
text(text.coords$x, text.coords$y, c('I', 'A', 'S', 'E', 'C', 'R'))
points(0, 0, pch=21, bg=1, col=0, lwd=2, cex=2)
此代碼創建的旋轉軸,但不能對數尺度和繪圖點到圖只可能通過xy座標,而不是XYZ。
如果有人能夠幫助我,那麼原文不會提供方法的描述,而且我在互聯網上找不到任何有用的東西,這將是非常棒的。 非常感謝!