R 如何剪辑坐标图

R 如何剪辑坐标图,r,ggplot2,R,Ggplot2,我正在尝试绘制一些高程数据(通常在-90到90度之间),使用coord\u polar我取得了一些成功。请看下面的代码: library(ggplot2) # r = c(2:8)*20 e = c(-4:9)*10 a = c(0:71)*5 points = expand.grid(r,e,a) colnames(points) = c("distance", "elevation", "azimuth") points$elevation[points$elevation <0]

我正在尝试绘制一些高程数据(通常在-90到90度之间),使用
coord\u polar
我取得了一些成功。请看下面的代码:

library(ggplot2)
#
r = c(2:8)*20
e = c(-4:9)*10
a = c(0:71)*5

points = expand.grid(r,e,a)
colnames(points) = c("distance", "elevation", "azimuth")
points$elevation[points$elevation <0] = points$elevation + 360

forEle = subset(points, azimuth == 0)


#ele_range = 
ggplot(forEle, aes( x=elevation, y=distance))+
geom_point()+
coord_polar(theta = "x", start = -1.5708, direction = -1)+
scale_y_continuous(breaks = c(0:16)*10, limits=c(0, 160)) +
scale_x_continuous(breaks=seq(0, 359, by=30), labels=c(expression(0^degree), expression(30^degree), expression(60^degree), expression(90^degree), expression(60^degree), expression(30^degree), expression(0^degree), expression(-30^degree), expression(-60^degree), expression(-90^degree), expression(-60^degree), expression(-30^degree)), limits=c(0, 360)) +
labs(title = "",
        x = "x",
        y = "y")+
theme(legend.position="bottom")
库(ggplot2)
#
r=c(2:8)*20
e=c(-4:9)*10
a=c(0:71)*5
点=展开网格(r、e、a)
colnames(points)=c(“距离”、“仰角”、“方位角”)

积分$elevation[积分$elevation我参加聚会有点晚了,但你是说这样的事吗

也可以用-90到90绕着整个圆圈进行

对于第一个:

scale_x_continuous(limits=c(-180,180),breaks=seq(-90, 90, 45))
对于第二个问题:

scale_x_continuous(limits=c(-90,90),breaks=seq(-90, 90, 45))

您是否有可用于复制问题(并测试解决方案)的示例数据集?另外,关于:输出剪辑,您是否尝试过
xlim()
?您好,谢谢,回答您的第一个问题,我提供的代码创建了从0到360度的绘图,我想要的是具有相同的绘图,但“放大”从-90度到90度。至于你的第二个问题,是的,我试过xlim()没有成功。@julovi:放大,你的意思是只希望绘图的右侧包含点,还是说径向变量应该在-90到90之间?我的意思是角度变量应该在-90到90之间。径向变量不重要。谢谢!虽然这不完全是我要求的,但你的绘图是正确的我将显示一个完整的圆,我只想剪辑“从北极到南极”的输出。您可以通过向coord_polar()添加开始=某个角度来调整原点的起始位置,但您不能剪切圆的任何部分。如果您想要一个半圆,则必须使用图像编辑程序剪切半个圆。实际上,显然您可以: