similar to: ggplot - adding regression lines

Displaying 20 results from an estimated 9000 matches similar to: "ggplot - adding regression lines"

2023 Aug 12
2
geom_smooth
Colleagues, Here is my reproducible code for a graph using geom_smooth set.seed(55) scatter_data <- tibble(x_var = runif(100, min = 0, max = 25) ?????????????????????? ,y_var = log2(x_var) + rnorm(100)) library(ggplot2) library(cowplot) ggplot(scatter_data,aes(x=x_var,y=y_var))+ ? geom_point()+ ? geom_smooth(se=TRUE,fill="blue",color="black",linetype="dashed")+
2023 Aug 12
1
geom_smooth
?s 05:17 de 12/08/2023, Thomas Subia via R-help escreveu: > Colleagues, > > Here is my reproducible code for a graph using geom_smooth > set.seed(55) > scatter_data <- tibble(x_var = runif(100, min = 0, max = 25) > ?????????????????????? ,y_var = log2(x_var) + rnorm(100)) > > library(ggplot2) > library(cowplot) > > ggplot(scatter_data,aes(x=x_var,y=y_var))+
2023 Aug 12
1
geom_smooth
G'day Thomas, On Sat, 12 Aug 2023 04:17:42 +0000 (UTC) Thomas Subia via R-help <r-help at r-project.org> wrote: > Here is my reproducible code for a graph using geom_smooth The call "library(tidyverse)" was missing. :) > I'd like to add a black boundary around the shaded area. I suspect > this can be done with geom_ribbon but I cannot figure this out. Some >
2010 Nov 30
1
Zooming in to a ggplot (a sort of ylim, but ylim won't do)
Dear Helpers, I wonder whether you might be able to help me. I have a plot composed of ggplot (and a follow on geom_smooth call). I would like to restrict the display range of the y axis to a smaller range, a sort of zooming onto a region. I attempted to use ylim, but it will effect the range (i.e. effect the geom_smooth call). Is there any way that I can save the results up to geom_smooth call
2010 Sep 16
1
plotting time series using ggplots
Hi, I would like to plot a bunch of tree ring width data (time series) using ggplots, but I'm having trouble figuring out how to do it. My data is in a data.frame, with years as rownames and a distinct tree ring series in each column. So, something like this: rwl<-matrix(rnorm(800), nrow = 100) colnames(rwl) <- paste('V', 1:8, sep = '')
2020 Sep 30
4
Graficar una curva de tendencia potencial.
AF_E PS_E 90.838 2.206 83.139 1.751 134.272 3.710 84.043 2.076 105.184 2.788 157.249 3.783 50.280 1.027 96.973 2.355 123.582 3.398 60.417 1.236 123.501 3.315 90.128 1.566 193.783 5.167 116.036 2.994 100.289 2.216 56.943 1.106 102.272 2.692 145.579 3.810 53.105 1.202 127.212 3.061 102.838 2.383 126.352 2.723 13.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
2023 May 16
1
Newbie: Drawing fitted lines on subset of data
Hello, I's still working with my tsibble of weight data for the last 20 years. In addition to drawing an overall trend line, using lm, for the whole data set, I'd like to draw short lines that would recompute lm and draw it, say, just for the years from 2010:2015. Here's a short example that I think illustrates what I'm trying to do. The commented out sections show what
2008 Sep 22
2
adding layers in ggplot2 (data and code included)
Here is some sample data: mydata <- read.table(textConnection("Est Group Tri 0 0 4.639644 1 0 4.579189 2 0 4.590714 0 1 4.443696 1 1 4.588243 2 1 4.650505 0 2 4.296608 1 2 4.826036 2 2 4.765386"),header=TRUE); closeAllConnections(); I can form two plots,
2012 Oct 30
4
Error unary operator
Hi R - listers, I am receiving an error. Does anyone know what this means? J ggplot(subset(foo, Rayos != "Rayos.NA"), aes(x=HTL, y=DevelopIndex, colour=TotalEggs)) +geom_point() +geom_jitter() + facet_grid(Aeventexhumed ~ Rayos) + geom_smooth(method="lm", fill=NA) + ylim(c(0, 7)) Error in +geom_smooth(method = "lm", fill = NA) : invalid argument to unary
2023 May 12
2
Newbie: Controlling legends in graphs
Hello, I'm trying to create a line graph with a legend, but have no success controlling the legend. Since nothing I've tried seems to work, I must be doing something systematically wrong. Can anyone point this out to me? Here's my data: > weights # A tibble: 1,246 ? 3 Date J K <date> <dbl> <dbl> 1 2000-02-13 133 188 2
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
2020 Oct 23
2
How to shade area between lines in ggplot2
also from this site: https://plotly.com/ggplot2/geom_ribbon/ I get the answer is geom_ribbon but I am still missing something ``` #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + geom_point() + scale_color_manual(values = c("red", "blue")) # show support vectors df_sv = trainset[svm_model$index, ] p = p + geom_point(data = df_sv, aes(x=x, y=y),
2011 Jun 26
1
changing graphs in qqplot2
This is what I have now so far. p=ggplot(data = test, aes(x = YEAR, y = TOTAL, colour = TREATMENT)) + geom_point() + geom_smooth(method = "lm", se=FALSE) + facet_wrap(~COUNTRY) > p +scale_x_continuous(limits=c(1,4)) http://r.789695.n4.nabble.com/file/n3626510/graph.gif I would also like to: 1.) change the headline for the faced wraps ?high? and ?low?. Is there any other way of
2020 Oct 23
2
How to shade area between lines in ggplot2
Thank you, but this split the area into two and distorts the shape of the plot. (compared to ``` p + geom_abline(slope = slope_1, intercept = intercept_1 - 1/w[2], linetype = "dashed", col = "royalblue") + geom_abline(slope = slope_1, intercept = intercept_1 + 1/w[2], linetype = "dashed", col = "royalblue") ``` Why there
2013 Jan 21
1
Very slow in processing the equation in the scatter plot ggplot
Hello All, I have plotted a scatter plot in ggplot2 and added a regression line and a regression equation. But the processing is very very slow. One reason might be because I have so many data pairs. Is there any way to speed up this code ? I need to create a multiple layout as well. The code I have used is as follows: setwd("C:/Users/jzd0009/Documents/R software") mydata <-
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
Dear all I would like to superpose some smoothing line through boxplot in ggplot > dput(ad) structure(list(konc.f = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
2020 Oct 23
5
How to shade area between lines in ggplot2
Hello, I am running SVM and showing the results with ggplot2. The results include the decision boundaries, which are two dashed lines parallel to a solid line. I would like to remove the dashed lines and use a shaded area instead. How can I do that? Here is the code I wrote.. ``` library(e1071) library(ggplot2) set.seed(100) x1 = rnorm(100, mean = 0.2, sd = 0.1) y1 = rnorm(100, mean = 0.7, sd =
2020 Oct 26
0
How to shade area between lines in ggplot2
Hi Put fill outside aes p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2]), fill = "blue", alpha=0.1) The "hole" is because you have two levels of data (red and blue). To get rid of this you should put new data in ribbon call. Something like newdat <- trainset newdat$z <- factor(0) p+geom_ribbon(data=newdat, aes(ymin =
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi What about something like p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1)) Cheers Petr > -----Original Message----- > From: Luigi Marongiu <marongiu.luigi at gmail.com> > Sent: Friday, October 23, 2020 11:11 AM > To: PIKAL Petr <petr.pikal at precheza.cz> > Cc: r-help
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi Did you try google? I got several answers using your question e.g. https://stackoverflow.com/questions/54687321/fill-area-between-lines-using-g gplot-in-r Cheers Petr > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Luigi Marongiu > Sent: Friday, October 23, 2020 9:59 AM > To: r-help <r-help at r-project.org> > Subject: