在R中打印有效/非缺失数据时获取Inf/-Inf错误
我想画四分之一的圆在R中打印有效/非缺失数据时获取Inf/-Inf错误,r,plot,R,Plot,我想画四分之一的圆 N = 1E1 # set of radiuses r = c(1,2,3,4) # plot quarter-circles plot(0,0) for (i in 1:length(r)) { quadX <- seq(from = 0,to = r[i],length.out = N) # print(quadX) quadY <- sqrt(r[i]^2 - quadX^2) print(quadY) p1 <- po
N = 1E1
# set of radiuses
r = c(1,2,3,4)
# plot quarter-circles
plot(0,0)
for (i in 1:length(r)) {
quadX <- seq(from = 0,to = r[i],length.out = N) #
print(quadX)
quadY <- sqrt(r[i]^2 - quadX^2)
print(quadY)
p1 <- points(quadX,quadY)
}
plot(p1)
在圣诞节前我发疯之前,任何帮助都将被感谢…更改初始绘图的边界以查看发生了什么:
plot(0,0,xlim=c(-5,5),ylim=c(-5,5))
@ErrorJordan就在这里。另外,p1
是NULL
,因此无论是plot(p1)
还是print(p1)
都不会帮助您,如果您注意到@ErrorJordan这样的绘图限制,您所需要的只是您拥有的代码,减去最后一行
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf