similar to: how to add mean value to regression line using ggplot?

Displaying 20 results from an estimated 4000 matches similar to: "how to add mean value to regression line using ggplot?"

2012 Oct 22
1
how to group smooth line by two groups?
Hello, I have the following sample dataset. sex <- as.factor(c(rep(0,12),rep(1,12))) char <-
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))+
2017 Jun 30
0
Multiple "scale_color_manual" statements in one plot (ggplot2, flexible legend challenge)
Dear list, I am facing an unusual situation where I need to create two sets of legends based on the color mapping. Can't get exactly what I want and really appreciate any advice from ggplot experts. Let's say I have the first dataset "df1" that draws some points and based on which a "loess" line with confidence interval is added. Then the second dataset
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")+
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
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
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 >
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),
2016 Apr 09
1
Run script R
hi all ,? i have an problem in script R . But when I execute the script R I face this error . can you help me please ???error:----------------------------------------- Error in FUN(X[[i]], ...) :?? Theme element 'text' has NULL property: margin, debugIn addition: Warning messages:1: Removed 361 rows containing non-finite values (stat_smooth).?2: Removed 361 rows containing missing values
2023 May 16
0
Newbie: Controlling legends in graphs
Rui, thanks so much for your help. Your explanation and example were clear and concise. Thanks for taking the time and effort to help me. -Kevin On 5/12/23 16:06, Rui Barradas wrote: > ?s 14:24 de 12/05/2023, Kevin Zembower via R-help escreveu: >> Hello, I'm trying to create a line graph with a legend, but have no >> success controlling the legend. Since nothing I've
2016 Apr 29
2
lm() with spearman corr option ?
Hi, A following function was kindly provided by GGally?s maintainer, Barret Schloerke. function(data, mapping, ...) { p <- ggplot(data = data, mapping = mapping) + geom_point(color = I("blue")) + geom_smooth(method = "lm", color = I("black"), ...) + theme_blank() + theme(panel.border=element_rect(fill=NA, linetype =
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:
2017 Oct 12
1
dual y-axis for ggplot
Hi John, You can try the following: override.linetype=c("twodash","solid") p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) p <- p +
2010 Sep 29
1
Obtaining lattice equivalent smoothed (loess) plot in ggplot
Hello, I have been struggling to do a plot in ggplot(2) that's of lattice equivalent. The following code shows the lattice plot.
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 =
2011 Aug 24
1
Scatter plots, linear regression in ggplot2
Hi, Based on some modification that I did to the R Cookbook Graphs Scatterplots code, link:http://wiki.stdout.org/rcookbook/Graphs/Scatterplots%20(ggplot2) I have some questions and I will appreciate a help: - How do I change the legend title? - How can I change the for each linear regression its color and linetype? - How can I add for both the linear regression lines their equations and Rseq
2007 Jan 13
0
MHII.OB(MARSHALL HOLDINGS INTERNATIONAL INC.) this special for you
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>MHII.OB this is really amazing company that you always dreamt</TITLE> </HEAD> <BODY> <html> <head> Following a meetingHe told the BBC there would be no UN troops. He told the BBC there would be no UN troops. <br> <meta
2017 Oct 12
0
dual y-axis for ggplot
Sorry let me clarify. If I modify the line p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) by p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) and p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) by p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity",
2000 Feb 29
0
mapping of colornames into hsv: half way done
Ok, now we have the mapping of color names to color codes (see below) and conversion to rgb (something like Ben Bolker's function), but how to convert rgb to hsv? Thanks to Brian Ripley, Peter Dalgaard and Ben Bolker Details below Regards Jens etc/colors.big maps 455 names to rgb in S syntax etc/rgb.txt maps 657 names to rgb in C syntax, but unlike colors() it has mixed upper and