极地Plotrix R包。情节象征覆盖

时间:2022-01-18 14:59:46

I'm using a polar plot to describe satellite position during a time series. The following question uses the polar.plot function from the R package plotrix. An example plot:

我用一个极地图来描述一个时间序列中的卫星位置。下面的问题用的是极性。从R包plotrix中绘制函数。剧情:一个例子

library(plotrix)
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
                          point.symbols=19,radial.lim=c(0,5),boxed.radial=F)

The issues I'm running across is that this function plots the labels and axis over the data values (see radial positions 0 and 3), and I don't see a way to control this behavior. I can run a workaround by adding the data values again (adding to the previous plot) with axis and labels turned off, but this is less than elegant:

我遇到的问题是,这个函数绘制了标签和数据值的轴(参见径向位置0和3),我看不到控制这种行为的方法。我可以通过再次添加数据值(添加到前面的图中),关闭轴和标签来进行变通,但这并不优雅:

polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           grid.left=F,point.symbols=19,show.radial.grid=FALSE,
           show.grid.labels=FALSE,show.grid=FALSE,labels=NULL,add=TRUE)

My question is two fold:

我的问题有两个方面:

  1. Is there a way to control this in plotrix that I've missed in the documentation?
  2. 有没有一种方法可以在plotrix中控制这个我在文档中漏掉的?
  3. Is there another package that can easily handle this kind of azimuth polar plot?
  4. 还有别的包可以轻松处理这种方位极图吗?

2 个解决方案

#1


3  

You can control the way those radial labels are displayed with two parameters: show.grid.labels and radial.labels. See ?radial.plot for more complete information.

您可以使用两个参数控制这些径向标签的显示方式:show.grid。标签和radial.labels。看到了什么?径向。绘制更完整的信息。

show.grid.labels accepts values from 1 to 4 (similar to that of pos or axis, see ?par or ?axis) controlling the side on which they are displayed. radial.labels accepts a vector of labels, so if you want the labels to be turned down: radial.labels = "" works,

show.grid。标签接受从1到4的值(类似于pos或axis,请参见?par或?axis),以控制显示它们的边。径向。标签接受一个标签向量,所以如果您希望标签被关闭:径向。标签= " ",

library(plotrix)
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2)

极地Plotrix R包。情节象征覆盖

polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2, radial.labels=c("",1:5))

极地Plotrix R包。情节象征覆盖

You can also get rid of the axial lines using show.radial.grid:

你也可以使用show.radial.grid:

polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2, radial.labels=c("",1:5), 
           show.radial.grid=FALSE)

极地Plotrix R包。情节象征覆盖

However there doesn't seem to be a way of making the lines lie behind the labels and the points, so if you do want the lines to appear behind then your original idea was probably the best:

然而,似乎没有一种方法可以让线条隐藏在标签和点的后面,所以如果你真的想让线条显示在标签和点的后面,那么你最初的想法可能是最好的:

polar.plot(NA,NA,start=90,clockwise=TRUE,rp.type="",
           radial.lim=c(0,5),boxed.radial=FALSE, show.grid.labels=2,
           radial.labels=c("",1:5)) # First plotting the grid
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),show.grid=FALSE, 
           show.radial.grid=FALSE, add=TRUE)  # Then the points without the grid

极地Plotrix R包。情节象征覆盖

I don't know of any other package having a function handling this kind of plot, however if you want to create your own function, this answer to your previous question can definitely help you start.

我不知道还有哪个包有函数来处理这种图,但是如果你想创建你自己的函数,这个问题的答案肯定可以帮助你开始。

#2


0  

This seems to have been fixed. I've not looked at the change log to determine where the change happened, but it is fixed as of at least plotrix 3.5-12.

这似乎已经被修正了。我还没有查看更改日志来确定更改发生的位置,但至少对于plotrix 3.5-12是固定的。

library(plotrix)
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",point.symbols=19,radial.lim=c(0,5),boxed.radial=F,grid.col="red",point.col="green")

极地Plotrix R包。情节象征覆盖

Currently the axes are plotted correctly under the data points. The labels are (reasonably) plotted on top. The overplot option discussed above would work well if it is necessary to have the data overlay the labels.

目前,坐标轴被正确地绘制在数据点之下。标签被(合理地)绘制在顶部。如果需要将数据覆盖到标签上,上面讨论的overplot选项将会工作得很好。

#1


3  

You can control the way those radial labels are displayed with two parameters: show.grid.labels and radial.labels. See ?radial.plot for more complete information.

您可以使用两个参数控制这些径向标签的显示方式:show.grid。标签和radial.labels。看到了什么?径向。绘制更完整的信息。

show.grid.labels accepts values from 1 to 4 (similar to that of pos or axis, see ?par or ?axis) controlling the side on which they are displayed. radial.labels accepts a vector of labels, so if you want the labels to be turned down: radial.labels = "" works,

show.grid。标签接受从1到4的值(类似于pos或axis,请参见?par或?axis),以控制显示它们的边。径向。标签接受一个标签向量,所以如果您希望标签被关闭:径向。标签= " ",

library(plotrix)
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2)

极地Plotrix R包。情节象征覆盖

polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2, radial.labels=c("",1:5))

极地Plotrix R包。情节象征覆盖

You can also get rid of the axial lines using show.radial.grid:

你也可以使用show.radial.grid:

polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),boxed.radial=FALSE, 
           show.grid.labels=2, radial.labels=c("",1:5), 
           show.radial.grid=FALSE)

极地Plotrix R包。情节象征覆盖

However there doesn't seem to be a way of making the lines lie behind the labels and the points, so if you do want the lines to appear behind then your original idea was probably the best:

然而,似乎没有一种方法可以让线条隐藏在标签和点的后面,所以如果你真的想让线条显示在标签和点的后面,那么你最初的想法可能是最好的:

polar.plot(NA,NA,start=90,clockwise=TRUE,rp.type="",
           radial.lim=c(0,5),boxed.radial=FALSE, show.grid.labels=2,
           radial.labels=c("",1:5)) # First plotting the grid
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",
           point.symbols=19,radial.lim=c(0,5),show.grid=FALSE, 
           show.radial.grid=FALSE, add=TRUE)  # Then the points without the grid

极地Plotrix R包。情节象征覆盖

I don't know of any other package having a function handling this kind of plot, however if you want to create your own function, this answer to your previous question can definitely help you start.

我不知道还有哪个包有函数来处理这种图,但是如果你想创建你自己的函数,这个问题的答案肯定可以帮助你开始。

#2


0  

This seems to have been fixed. I've not looked at the change log to determine where the change happened, but it is fixed as of at least plotrix 3.5-12.

这似乎已经被修正了。我还没有查看更改日志来确定更改发生的位置,但至少对于plotrix 3.5-12是固定的。

library(plotrix)
polar.plot(c(0,1,3,4),c(30,60,90,120),start=90,clockwise=TRUE,rp.type="s",point.symbols=19,radial.lim=c(0,5),boxed.radial=F,grid.col="red",point.col="green")

极地Plotrix R包。情节象征覆盖

Currently the axes are plotted correctly under the data points. The labels are (reasonably) plotted on top. The overplot option discussed above would work well if it is necessary to have the data overlay the labels.

目前,坐标轴被正确地绘制在数据点之下。标签被(合理地)绘制在顶部。如果需要将数据覆盖到标签上,上面讨论的overplot选项将会工作得很好。