search for: stat_smooth

Displaying 20 results from an estimated 54 matches for "stat_smooth".

2011 Oct 03
4
Question about ggplot2 and stat_smooth
I'm interested in creating a graphic -like- this: c <- ggplot(mtcars, aes(qsec, wt)) c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, alpha = 0.2) but I need to show 2 sets of bands (with different shading) using 5%, 25%, 75%, 95% limits that I specify and where the heavy blue line is the median. I don't understand how to do this with ggplot2. What I am doing cu...
2007 Nov 16
1
Exponential Smoothing for ggplot2's stat_smooth()
Hello everyone, I was wondering if anyone was aware of a way in which I could use ggplot's stat_smooth() function for add an exponential moving average. I was thinking that I could maybe use something like: >myggplot + stat_smooth (method = 'HoltWinters( data , .9 , 0, 0)') but my efforts were futile. Perhaps there is a way to write my own custom method to throw into stat_smooth?? Th...
2009 Feb 04
5
ggplot: problem with fill option in stat_smooth()
Hi all, I am using ggplot2 and continuing to find it very useful and pretty. However, I am trying to create some graphics for publication that would be included in an MS Word document (not my choice!) in Windows Vista. The problem is that I want to use stat_smooth() to add an fitted linear model line along with its 95% confidence band, but I cannot seem to get the confidence band in a format that would import into Word. I have read the documentation and am using the fill="grey50" argument to eliminate transparency as a potential problem. But stil...
2013 Mar 08
2
ggplot2: modifying line width and background fill color for stat_smooth()
...ed for the separate fitted lines for GENDER, rather than grey for both. How can I do this? donner<-read.csv("http://www.ling.upenn.edu/~joseff/data/donner.csv") ggplot(donner, aes(AGE, NFATE, color = GENDER))+ geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(method = "glm", family = binomial, formula = y ~ poly(x,2)) For the line width, I tried, ggplot(donner, aes(AGE, NFATE, color = GENDER))+ geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(aes(size=2), method = "glm", family = binomial, formul...
2013 Dec 17
1
ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula
With ggplot2, I can plot the glm stat_smooth for binomial data when the response is binary or a two-level factor as follows: data("Donner", package="vcdExtra") ggplot(Donner, aes(age, survived)) + geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(method = "glm", family = binomial, f...
2010 Sep 11
1
ggplot: stat_smooth() and nls method
Hi all, Does one of you know if there is any way to combine a "nls" method in the stat_smooth of ggplot? Regards -- ------------- Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes" Avenue du G?n?ral Leclerc CS 50837 35708 Rennes CEDEX 7 Tel 33 (0)2 23 23 80 83 Fax 33 (0)2 23 23 81 20 http://www.e...
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
...ot;), class = "factor")), .Names = c("konc.f", "bel", "typ"), row.names = c(NA, -102L), class = "data.frame") > Here is what I did p<-ggplot(ad, aes(x=konc.f, y=bel, colour=typ)) p+geom_boxplot()+geom_jitter(position=position_jitter(w=0.1))+stat_smooth() geom_smooth: Only one unique x value each group.Maybe you want aes(group = 1)? I get nice picture with boxes but I expected to get something like smoothing line through box centres. Is it possible without some hack to stat_smooth code? Regards Petr
2011 Mar 24
1
questions regarding stat_smooth in ggplot area plot
Hello, I drew a simple area plot using ggplot2 using set <- read.table(file="http://www.jovian.nl/set.csv", head=1, sep=",") library(ggplot2) ggplot() + layer( data = set, mapping = aes(x = time, y = hours), geom = "area", stat="smooth", color="red" ) + layer( data = set, mapping = aes(x = time, y = hours), geom = "area",
2008 Oct 22
1
ggplot scale limit and stat_smooth
In the change log of ggplot2, version 0.7, I find this: "* scales: any point outside of limits is dropped (this was previously the behaviour for discrete scales, but not continuous scales)" and that makes sense for some applications. But what about if I want to summarize the data with a smooth, and (a) include the effect of all values, but (b) "zoom in" on the smooth by
2010 Aug 14
1
is it possible to map 2 plots(c and d) in a single output plot?
is it possible to map 2 plots(c and d) in a single output plot? library(ggplot2) c <- ggplot(mtcars, aes(qsec, wt)) d <- ggplot (mtcars, aes(qsec, wt)) c + stat_smooth(fill="darkgrey", colour="blue", size=2, alpha = 0.2) d + stat_smooth(fill="darkgrey", colour="red", size=2, alpha = 0.2) -- View this message in context: http://r.789695.n4.nabble.com/is-it-possible-to-map-2-plots-c-and-d-in-a-single-output-plot-tp2325023p23...
2007 Sep 27
1
Cairo on windows
Hi All, I just installed Cairo on R 2.5.1 on windows XP. My hope was to get to see the transparency output e.g. http://had.co.nz/ggplot2/stat_smooth.html ggplot2 - stat_smooth , which I finally managed to do. However, I find the Cairo device, which I access either through CairoWin() or Cairo(type="win"), is pretty shaky in a number of respects : - whatever portion of the Cairo device that is covered by the R command window does not...
2009 Apr 29
2
help converting for loop to vector operation
...qplot( data=df, x=date, y=df[,i], geom=c('line','jitter'), ylab=mlabel, main=mlabel, colour=I("dark blue") ) if ( smooth == TRUE ) { print("smoother requested...") tmp <- qmetric qmetric <- tmp + stat_smooth() } pngfn <- paste( BASEPATH, mlabel, ".png", sep="") print(pngfn) png( file=pngfn, height=h, width=w ) print(qmetric) dev.off() } basepath <- "C:/tmp" for ( i in c(2:6) ) { print...
2012 Sep 26
1
Interaction scatterplots in ggplot with multiple regression lines
...d(1234) predictor <- rnorm(1000, 3) outcome <- rnorm(1000, 10) moderator <- rnorm(1000) mydata <- data.frame(predictor, outcome, moderator) ggplot(mydata, aes(x=predictor, y=outcome, color=moderator)) + geom_point() + scale_colour_gradient2(low="blue", high="red") + stat_smooth(method=lm, se=TRUE, fullrange=T) ########################### Also, how can I set how many discrete levels to plot (e.g., 3 instead of 7)? Thanks in advance!
2010 Dec 24
0
ggplot2 0.8.9 - Merry Christmas version
...with NAs in x * scale_alpha: setting limits to a range inside the data now works (thanks to report by Dr Proteome) * scale_colour_continuous: works correctly with single continuous value (fixes #73) * scale_identity: now show legends (fix #119) * stat_function: now works without y values * stat_smooth: draw line if only 2 unique x values, not three as previously * guides: fixed #126 * stat_smooth: once again works if n > 1000 and SE = F (thanks to bug report from Theiry Onkelinx and fix from Kohske Takahashi) * stat_smooth: works with locfit (fix #129) * theme_text handles alignment be...
2010 Dec 24
0
ggplot2 0.8.9 - Merry Christmas version
...with NAs in x * scale_alpha: setting limits to a range inside the data now works (thanks to report by Dr Proteome) * scale_colour_continuous: works correctly with single continuous value (fixes #73) * scale_identity: now show legends (fix #119) * stat_function: now works without y values * stat_smooth: draw line if only 2 unique x values, not three as previously * guides: fixed #126 * stat_smooth: once again works if n > 1000 and SE = F (thanks to bug report from Theiry Onkelinx and fix from Kohske Takahashi) * stat_smooth: works with locfit (fix #129) * theme_text handles alignment be...
2011 Jun 26
1
changing graphs in qqplot2
...p(~NITROGEN) #this is the treatment A, but should only be displayed in the right graph (low). p + geom_abline(intercept = 81.476,slope=47.2667, colour = "red", size = 1) http://r.789695.n4.nabble.com/file/n3626510/graph2.gif b. Another option I?ve tried is to specify the model in the stat_smooth and geom_smooth commandsm=, but in both cases I get an error message. > p + stat_smooth(method = "lm", formula = TOTAL ~ TREATMENT + YEAR + > COUNTRY + TREATMENT:YEAR)+ + geom_point() Error in model.frame.default(formula = formula, data = data, weights = weight, : variable leng...
2020 Sep 30
4
Graficar una curva de tendencia potencial.
....661 0.190 164.352 4.870 159.945 4.160 54.382 0.884 128.253 3.598 181.208 4.767 145.118 3.779 65.993 1.147 Hola buenas tardes quiero graficar una curva de tendendia de un modelo potencial con estos datos. mi codigo es el siguiente: ggplot(modelos_Garcia,aes(x = AF_E,y = PS_E)) + geom_point() + stat_smooth(method = 'nls', formula = 'y~a*x^b', start = list(a = 1,b=1),se=TRUE) pero cuando ejecuto el código no me aparece la curva de tendencia ¿alguien sabe cómo podría hacerlo?. por otro lado me gustaría añadir la ecuación del modelo. agradezco mucho la información que puedan darme. [[...
2007 Jun 19
0
ggplot2 0.5.2
...out more at http://had.co.nz/ggplot2 Changes in version 0.5.2 ------------------------------ * add argument to position dodge so it's now possible to accurately dodge things with different widths to their physical widths * added median summary * new examples: * logistic regression example in stat_smooth * bugs fixed: * evaluation of arguments to layer is no longer delayed * can use categorical xseq with stat_smooth * x and y axes named incorrectly (thanks to Dieter Menne for spotting this) * can now pass position objects to qplot * y jitter calculated correctly, and jittered data rescales axi...
2007 Oct 21
0
ggplot2 - version 0.5.6
...are missing * better error messages if data not a data frame, or mapping not created by aes or aes_string * better errors for qplot when variables missing or data invalid * better error if somehow you are missing necessary scales * stat_bin informs you of the default choice of binwidth * stat_smooth gives helpful error messages for common problems * printing a geom now displays the data set that it uses (if not the default) Other improvements: * colour and fill legends now surround by background plot colour * can now draw arrow heads with geom_segment, and have added an example demonstr...
2007 Jul 09
0
Problem with Sweave and pdf version 1.4
...ge{Sweave} \SweaveOpts{echo = FALSE, pdf.version=1.4, eps = FALSE} \begin{document} \begin{figure} \centering <<tmp, fig = T, width = 5, height = 4>>= library(ggplot2) x <- runif(100) dataset <- data.frame(x = x, y = 5 * x + rnorm(100)) ggplot(dataset, aes(y = y, x = x)) + stat_smooth() + geom_jitter() @ \caption{Here comes a caption.} \label{fig:tmp} \end{figure} \begin{figure} \centering <<fig = F>>= pdf(file="foo.pdf", version="1.4") ggplot(dataset, aes(y = y, x = x)) + stat_smooth() + geom_jitter() dev.off() @ \incudegraphics{foo} \c...