【发布时间】:2015-06-03 21:35:53
【问题描述】:
目标是在 R 中重现此 Bid-Rent 图:
挑战是绘制投影的圆圈。到目前为止,我得到了:
2D部分是由下面的R代码用base R中的传统图形系统创建的:
#Distance
X <- seq(0,7,1)
#Bid Rent Curves: Commercial, Industrial, Residential
com <- -5*X + 10
ind <- -2*X + 7
res <- -0.75*X + 4
graph <- plot(X, com, type="l", col="green", ylim=c(0,10), xlab="", ylab="", axes=FALSE)
lines(X, ind, col="red")
lines(X, res, col="blue")
abline(v=0, h=0)
segments(1,0, 1,5, lty=2)
segments(2.5,0, 2.5,2, lty=2)
title(main="Bid Rent Curves", sub="Alonso Model",
xlab="Distance from CBD", ylab="Rent per m2")
text(2.5,7.5, "Commercial", col="green")
text(3.5,4, "Industrial", col="red")
text(5.5,2, "Residential", col="blue")
- (详情:为什么曲线不遵守 ylim = 0 ?)
- 如何进行投影并绘制半圆?
这并不完全是 3D 情节。我研究了 plot3D 和 rgl。我不确定从这里使用哪些包或策略。
【问题讨论】:
-
ylim 问题很简单。看'?par'。默认设置在最大和最小点值周围添加了额外的空间,以便可以完全表示“点”。您可以更改为轴类型/样式:
yaxs="i"。它们看起来不像您提供的图片中的圆圈甚至和弦。