Are either one of these closer to what you want? I'm not sure I know
what you mean by "without the lines where the densities overlap"
x1 <- c(rep(0, 250), rlnorm (1000))
x2 <- c(rlnorm(1250))
x <- data.frame(x1, x2)
x.long <- melt(x, measure.vars=c("x1","x2"))
ggplot(x.long, aes(x=value)) +
geom_segment(aes(x=value, xend=..x..+0.2, y=..density..,
yend=..density.., colour=variable),
stat="bin", binwidth=0.2) +
coord_cartesian(xlim = c(-1, 15))
ggplot(x.long, aes(x=value)) +
geom_step(aes(x=value, y=..density.., colour=variable),
stat="bin", binwidth=0.2) +
coord_cartesian(xlim = c(-1, 15))
> On Mar 28, 2:27 pm, Brandon Hurr<brandon.h...@gmail.com> wrote:
>> How about...
>> ggplot() + geom_histogram(aes(x=x), binwidth = 1, color =
>> + 'NA', fill = 'white')
>>
>> B
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Mar 28, 2011 at 20:21, David L<dleba...@gmail.com> wrote:
>>> ggplot() + geom_histogram(aes(x=x), binwidth = 1, color =
>>> 'black', fill = 'white')
>>
>>
>>
>> NA.png
>> 144KViewDownload
>
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University
Both examples are very nice.
The second one, using geom_step, is what I originally pictured, but
the geom_segment is also appealing.
Thank you very much for your help
-David
--
David LeBauer, PhD
Energy Biosciences Institute
University of Illinois Urbana-Champaign
1206 W. Gregory Drive
Urbana, IL 61801, U.S.A.