Re: [R] Density plot error

2016-09-19 Thread Jeff Newmiller
You desperately need to read the Posting Guide mentioned at the bottom of every posting on this list. Avoid attachments (your code did not come through), keep sample data size minimal, don't reply to other topic messages (start a fresh email thread so your message doesn't get buried in other peo

[R] Density plot error

2016-09-19 Thread najad zamirah zaki via R-help
Hi, I'm Najad, a student at the University of Glasgow. I really need help with a script of mine to plot density plot for my data. I kept on having an error saying need at least 2 points to select a bandwidth automaticallyI've tried to replace the NaN in my data to zero but still the same. I'm no

Re: [R] density plot not smooth

2015-03-18 Thread Fix Ace
Thank you very much! I do need to learn more about R!! On Tuesday, March 17, 2015 9:26 PM, William Dunlap wrote: Fix Ace wrote    What is the default "n"? 512:   > length(density(rnorm(10^6))$x)   [1] 512   > args(density.default)    function (x, bw = "nrd0", adjust = 1, kernel = c(

Re: [R] density plot not smooth

2015-03-18 Thread S Ellison
> I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to > examine only small range of data, I found that the plot was not smooth (as > shown below): > plot(density(test$V2), xlim=c(0,1000)) > > >  Is there away to make it smoother? For small ranges, use 'from' and 'to' i

Re: [R] density plot not smooth

2015-03-17 Thread Fix Ace
Thank you for the email. What is the default "n"? Thanks! On Tuesday, March 17, 2015 4:06 PM, William Dunlap wrote: Increasing the value of 'n' given to density will give an estimate at more points so it will look smoother.  Try n=2^18. Bill Dunlap TIBCO Software wdunlap tibco.com

Re: [R] density plot not smooth

2015-03-17 Thread William Dunlap
Fix Ace wrote What is the default "n"? 512: > length(density(rnorm(10^6))$x) [1] 512 > args(density.default) function (x, bw = "nrd0", adjust = 1, kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), weights = NULL, w

Re: [R] density plot not smooth

2015-03-17 Thread William Dunlap
Increasing the value of 'n' given to density will give an estimate at more points so it will look smoother. Try n=2^18. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace wrote: > > > I have a dataset with 6187 elements, ranged from 3 to 104028. When I > tr

[R] density plot not smooth

2015-03-17 Thread Fix Ace
I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to examine only small range of data, I found that the plot was not smooth (as shown below): plot(density(test$V2), xlim=c(0,1000))  Is there away to make it smoother? Thanks a lot!!     ___

Re: [R] density plot on a log scale

2012-06-14 Thread John Kane
t, price)) + geom_point(alpha = 1/10) p http://had.co.nz/ggplot2/geom_point.html John Kane Kingston ON Canada > -Original Message- > From: j...@bitwrit.com.au > Sent: Thu, 14 Jun 2012 21:39:36 +1000 > To: field.c...@gmail.com > Subject: Re: [R] density plot on a log s

Re: [R] density plot on a log scale

2012-06-14 Thread Jim Lemon
On 06/14/2012 07:08 PM, field.cady wrote: I'm working with a large dataset - large enough that when I do a scatter plot the points all blur together, so I want to plot their density by color - a heat map or something like that. I've used smoothScatter for tasks like this, but the problem is that

[R] density plot on a log scale

2012-06-14 Thread field.cady
I'm working with a large dataset - large enough that when I do a scatter plot the points all blur together, so I want to plot their density by color - a heat map or something like that. I've used smoothScatter for tasks like this, but the problem is that my current dataset really only looks good o

Re: [R] density plot with frequency units

2011-08-16 Thread r student
Let me ask another way. Is there a way to create a histogram with a fitted line, but without bars? Or, perhaps draw the bars with invisible lines? Thanks. On Tue, Aug 16, 2011 at 7:29 AM, Jeff Newmiller wrote: > This is a nonsensical request. It is like saying you want to plot the speed > of

Re: [R] density plot with frequency units

2011-08-16 Thread Jeff Newmiller
This is a nonsensical request. It is like saying you want to plot the speed of a falling object but you want the units of speed to be meters. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Li

[R] density plot with frequency units

2011-08-16 Thread r student
I would like to create a kernal density plot, but rather than show density units on the vertical axis I would like frequencies. I know histograms do this but I don't want the bars, just the density curve. Thanks! __ R-help@r-project.org mailing list h

Re: [R] density plot for weighted data

2011-08-02 Thread Thomas Lumley
On Wed, Aug 3, 2011 at 5:11 AM, r student wrote: > Like below? > > plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP))) > Yes If you are doing lots of analyses with weighted data you might want to look at the survey package. It also has a density estimator, in svysmooth(), which works very mu

Re: [R] density plot for weighted data

2011-08-02 Thread r student
Like below? plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP))) On Tue, Aug 2, 2011 at 10:06 AM, David Winsemius wrote: > > On Aug 2, 2011, at 12:51 PM, r student wrote: > >> I'm trying to create a density plot using census data, where the >> weights don't sum to 1. >> >> >>> plot(density

Re: [R] density plot for weighted data

2011-08-02 Thread David Winsemius
On Aug 2, 2011, at 1:11 PM, r student wrote: Like below? plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP))) I don't understand why you are asking for approval. You are the one with the data and know where they came from. We have none of that background. -- David. On Tue, Aug 2, 20

Re: [R] density plot for weighted data

2011-08-02 Thread David Winsemius
On Aug 2, 2011, at 12:51 PM, r student wrote: I'm trying to create a density plot using census data, where the weights don't sum to 1. plot(density(oh$FINCP,weights=oh$PWGTP)) Warning message: In density.default(oh$FINCP, weights = oh$PWGTP) : sum(weights) != 1 -- will not get true dens

[R] density plot for weighted data

2011-08-02 Thread r student
I'm trying to create a density plot using census data, where the weights don't sum to 1. >plot(density(oh$FINCP,weights=oh$PWGTP)) Warning message: In density.default(oh$FINCP, weights = oh$PWGTP) : sum(weights) != 1 -- will not get true density How would I go about doing this? Thanks!

Re: [R] density plot of simulated exponential distributed data

2011-04-28 Thread Juanjuan Chai
I tried logspline function using a lower bound 0 for my data, it works like a charm. When the I changed the xlim only positive part, the vertical line was also gone. That's exactly what I expected. Thanks. -JJ Greg Snow wrote: You might want to use the logspline package instead of the density

Re: [R] density plot of simulated exponential distributed data

2011-04-27 Thread Breheny, Patrick
help-boun...@r-project.org] On Behalf Of Greg Snow Sent: Wednesday, April 27, 2011 1:55 PM To: Juanjuan Chai; r-help@r-project.org Subject: Re: [R] density plot of simulated exponential distributed data You might want to use the logspline package instead of the density function, it allow

Re: [R] density plot of simulated exponential distributed data

2011-04-27 Thread Greg Snow
p-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Juanjuan Chai > Sent: Tuesday, April 26, 2011 4:19 PM > To: r-help@r-project.org > Subject: [R] density plot of simulated exponential distributed data > > Hi all, > > I tried to plot the den

Re: [R] density plot of simulated exponential distributed data

2011-04-26 Thread Dennis Murphy
Hi: Try this (and note the use of vectorization rather than a loop): rate <- 3 dta <- -log(1 - runif(1000))/rate hist(dta, nclass = 30, probability = TRUE) x <- c(0.001, seq(0, 3, by = 0.01)) lines(x, dexp(x, rate = 3)) This is the difference in timings between the vectorized and iterative metho

[R] density plot of simulated exponential distributed data

2011-04-26 Thread Juanjuan Chai
Hi all, I tried to plot the density curve using the data from simulation. I am sure that the data should be exponentially distributed, but the plot of density curve always starts from (0,0) which is not the case for exponential distribution. Is there any way around this, to keep the curve

Re: [R] Density plot with lattice?

2010-12-21 Thread Dennis Murphy
Hi: Try this: densityplot( ~ height | voice.part, data = singer, layout = c(2, 4), xlab = "Height (inches)", bw = 5) densityplot( ~ height | voice.part, data = singer, layout = c(2, 4), xlab = "Height (inches)", bw = 5, plot.points = FALSE) The plot.points argument is a

[R] Density plot with lattice?

2010-12-21 Thread Marie-Hélène Hachey
Hi, Is it possible to remove the points at the base of a density plot?I would like to keep only the curves of the plot, not the points. Thank you. Marie-Helene HacheyM.Sc. studentUniversite Laval, Quebec __ R-h

Re: [R] Density plot in ggplot2

2009-07-28 Thread Matthieu Dubois
Hi, small modifications to your code will do the trick > Here everything is ok, except few points : > 1. I want to remove the name of y-axis, which is by default "density". Here > I put ylab(""), however although for x-axis it is working, for y-axis it is > not. Is there any specific formula for

Re: [R] Density plot in ggplot2

2009-07-28 Thread Paul Emberson
Hi Ron, I'm not sure why ylab doesn't work. Maybe a bug. I note the label doesn't get removed with labs() either. However using scale_y_continuous(name="") does remove the label. For the legend, you are using a fill scale, not a colour scale i.e. fill=factor(dat[,2]), not colour=factor(da

[R] Density plot in ggplot2

2009-07-28 Thread RON70
Hi all, I was trying to draw a stacked density plot like that : library(ggplot2); library(plyr) dat <- cbind(rnorm(300), rep(c(1,2), each=150)) ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]), position="stack")) + xlab("") + ylab("") + scale_colour_manual(name = "

Re: [R] density plot & probabilities

2009-02-01 Thread Uwe Ligges
gregor rolshausen wrote: hello ! I have question concerning *kernel density plots*: how to plot of a vector, when that vector is very short (5-10 values)? I tried: > plot(density(x)) or > hist(x,probability=T,border="white") > lines(density(x)) for small length of vectors, the ylab i

[R] density plot & probabilities

2009-02-01 Thread gregor rolshausen
hello ! I have question concerning *kernel density plots*: how to plot of a vector, when that vector is very short (5-10 values)? I tried: > plot(density(x)) or > hist(x,probability=T,border="white") > lines(density(x)) for small length of vectors, the ylab is not 0from 0 to 3. thats confu

[R] density plot

2008-03-05 Thread Tom Hart
Hi, I'm trying to create a density plot which I used to do in geneplotter using the following code. Unfortunately I can't find the combination of R release and geneplotter that works. Can anyone suggest a fix or an alternative to smoothScatter that will plot depth of one dive vs depth of the nex