English 中文(简体)
利用微粒或利用微粒的其他替代包
原标题:modified polar plot using ggplots or other alternative packages using R

我试图用以下数据制造极地块。

gr1 <- c(0, 5, 15, 20, 30, 40)
gr3 <- c(0, 5, 10, 25, 40, 60, 80)
gr2 <- c(0, 15, 25, 30, 40)

df2<- data.frame (pos = c(gr1, gr2, gr3), group = c(rep(1, length(gr1)),
 rep(2, length(gr1)), rep(2, length(gr1))))



inner circle segment to mark
                   first tier, group 1, between 15, 20
                               group 3, between 5, 10
                                        between  40 to 60 
                   second tier, group 1, between 15, 20
                               group 3, between 5, 10
                                        between 10, 25
                                        between  40 to 60 

两岸间两行之间的争.。

我的实际数据分两层以上。

标记可以是部分标记,也可以是其他标记,如填充的颜色。

不同的群体如有可能,可以有色码。

“entergraph

替代部分标识(首页)

“entergraph

我用批号2对其进行审判。

cx <- ggplot(df2, aes(x = pos, group = group) +   geom_bar(width = 1, colour = "black"))
Error in aes(x = pos, group = group) + geom_bar(width = 1, colour = "black") :
  non-numeric argument to binary operator
cx + coord_polar()

更多审判:

df2$cpos <- cumsum (df2$pos)
cx <- ggplot(df2, aes(x = cpos, group = group) +   geom_bar(width = 1, colour = "black"))

I think I might be terrible to explain the issue. Here is figure with explanation. enter image description here

假设(位置)是连续的,极地的角视位置的价值而定。 一旦一个小组完成,它将重新启动。 我 did了这个骗子(我可能错了)。

Edits:

下面的回答为这一问题提供了更多的考虑。 这是经过改进的版本,但彩色管理没有发挥作用。

df2$cpos <- cumsum (df2$pos)
df2$y <- rep(3, length (df2$cpos))
cx <- ggplot(df2, aes(y = y, x = cpos))
cx + geom_bar(aes(stat = "identity",fill="yellow", colour = "yellow" )) + 
geom_point(aes(color = factor(group)), pch = 18, size = 2) + coord_polar() +
 scale_fill_manual(values=c("#CC6666", "#9999CC", "#66CC99"))+ ylim(0,3)

“entergraph

当我试图 set平时(2,3),这样他们就象一些不工作的群体一样。

Error in data$y[data$y == -Inf] <- range$y.range[1] : 
  replacement has length zero
最佳回答

我对你想要做的事情有很强的时间理解(或许你知道的是,在战争中,我们定有定点频率)。 然而,这里是将这些群体划入肤色的一种方式:

gr1 <- c(0, 5, 15, 20, 30, 40)
gr3 <- c(0, 5, 10, 25, 40, 60, 80)
gr2 <- c(0, 15, 25, 30, 40)

df2<- data.frame (pos = c(gr1, gr2, gr3), group = c(rep(1, length(gr1)),
 rep(2, length(gr2)), rep(3, length(gr3))))
df2$cpos <- cumsum (df2$pos)

cx <- ggplot(df2, aes(fill = factor(group), x = cpos))

cx + geom_bar(width = 1, colour = "black", position = "dodge")  + coord_polar()

“enterography

如果您想把物料作为频率,请在<代码>reshape2上使用melt()。

如果你想像你那样做的话,那么,能否走到工作的道路?

cx <- ggplot(df2, aes(y = group, x = cpos))

cx + geom_point(aes(color = factor(group))) + coord_polar() + ylim(0,3)

不管怎么说,你看着模式? 绘制一块地块,用X-轴线作为角和轴心,距离中间线,然后将其变成极地坐标。

“entergraph

Answer to Edit2

我仍不禁要问,你是否能够作出更有意义的事情,但也许有理由这样做。 这里的阴谋更接近你的例子。 它是完美的。 或许,在你到达办事处后,古尔明天可以提出更好的建议。 在你能够寻找更多的规格时,请参阅。 摘自

library(ggplot2)

gr1 <- c(0, 5, 15, 20, 30, 40)
gr3 <- c(0, 5, 10, 25, 40, 60, 80)
gr2 <- c(0, 15, 25, 30, 40)

df2<- data.frame (pos = c(gr1, gr2, gr3), group = c(rep(1, length(gr1)),
 rep(2, length(gr2)), rep(3, length(gr3))), y  = c(rep(1, length(gr1)),
 rep(2, length(gr1)), rep(2, length(gr1))))

df2$cpos <- cumsum (df2$pos)

cx <- ggplot(df2, aes(y = y, x = cpos))
cx + geom_point(aes(color = factor(group)), size = 4) + geom_line(aes(x = c(0,500), y = c(1)), color = "yellow") + 
geom_line(aes(x = c(0,500), y = c(2)), color = "blue") + scale_y_continuous(limits=c(0,2), breaks = c(0,1,2)) +
scale_x_continuous(labels = df2$pos, breaks = df2$cpos, limits = c(0,500)) + coord_polar() +
opts(panel.grid.major = theme_line(colour = "grey"), 
panel.grid.minor = theme_line(colour = "grey", linetype = "dashed"), 
panel.background = theme_rect(colour = "white"))

“entergraph

问题回答

暂无回答




相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签