English 中文(简体)
哪一种最简单的方法来填充地平地线下的面积?
原标题:What is the simplest method to fill the area under a geom_freqpoly line?
  • 时间:2010-05-02 19:21:48
  •  标签:
  • r
  • ggplot2

轴心是时间间隔。 数据框架中有一个interval栏,规定了每一行的时间。 该栏是一个因素,每个间隔期的系数不同。

用地平板和地平地铺设了一张海图或线,但我只想有一条线,如地平地提供的线,填满该地区。

目前,Im使用大地,像:

ggplot(quake.data, aes(interval, fill=tweet.type)) + geom_freqpoly(aes(group = tweet.type, colour = tweet.type)) + opts(axis.text.x=theme_text(angle=-60, hjust=0, size = 6))

“plots”/

我宁愿有一个填充的区域,如<代码>geom_density所规定的,但不会顺利地划分:

alt=“smoth>。

有人建议,对于地_area s y- Values,是否以任何方式使用聚合-生成的统计学,如:上。 或者,在使用聚合物之前是否有必要进行计算?


如回答所述,Kum_area(......,stat=“bin”)是解决办法:

ggplot(quake.data, aes(interval)) + geom_area(aes(y = ..count.., fill = tweet.type, group = tweet.type), stat = "bin") + opts(axis.text.x=theme_text(angle=-60, hjust=0, size = 6))

生产:

最佳回答

也许你想要:

geom_area(aes(y = ..count..), stat = "bin")
问题回答

<代码>geom_ribbon 可以在两条线路之间生产一个填充区,无需明确构筑多环。 http://ggplot2.tidyverse.org/fer/geom_ribbon.html” rel=“nofollow noreferer”>。

ggplot (quake.data, aes (interval, comp=tweet.type, group = 1) + Geom_density()

但我认为这不是一个有意义的图表。

我并不完全确定你的目标。 你们想要一条线或条条条。 http://docs.ggplot2.org/ 当前/geom_bar.html” 类似:

p <- ggplot(data, aes(x = time, y = count))
p + geom_bar(stat = "identity")

如果你想要在地下填满一条线,那么你就应当看geom_area,而我个人却使用过这个线,但似乎该建筑几乎相同。

p <- ggplot(data, aes(x = time, y = count))
p + geom_area()

希望会有所帮助。 给某些人带来更多的信息,我们可能更有助益。

实际上,我会 throw上指数,仅仅 the取数据,使用x,然后使用x。

p <- ggplot(data, aes(x = index, y = count))
p + geom_bar(stat = "identity") + scale_x_continuous("Intervals", 
breaks = index, labels = intervals)




相关问题
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 ...

热门标签