similar to: how to group smooth line by two groups?

Displaying 20 results from an estimated 400 matches similar to: "how to group smooth line by two groups?"

2012 Oct 18
0
how to add mean value to regression line using ggplot?
I have generated plot using ggplot, and i would like to add mean value to the regression line as a marker. how to do it? p <- ggplot(data, aes(x = x, y = y, color = a, shape = factor(sex), linetype = factor(sex))) p0 <- p + scale_color_manual(values=c("#00FFFF", "#FFFF00", "#00FF00")) +
2013 Feb 01
2
Change default order of colors & line types
Dear R users, I'd like to change the default order of colors & line types. Especially I am using ggplot2 and using color Set1. In Set1, the default color order is red, blue, green, violet,.. ect. However, I want to put red in fourth (not first). Likewise, I want to change the order of default linetype. I want to put "solid" line in fourth. How can I do thses? R code to draw the
2018 May 22
3
legend order in ggplot2
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_a", "name_c". I'd like to legend to present in the order: the "name_b" at the top, and "name_c" at the bottom. As a consequence, the legend is indeed in the order:
2003 Aug 29
2
Lattice plot questions
Win2k, R1.7.1: I am currently working with some growth curve data from a biotoxicology experiment. Each of 12 subjects had their blood drawn at 0, 2, 4, 6, 8, and 10 weeks. For the purposes of the project, it would be helpful if I were able to do the following: a. Produce 12 panels, each displaying the *same* data, with the "strip" at the top of a particular panel showing
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 +
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",
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
2
dual y-axis for ggplot
Hi, To my knowledge, an excellent of ggplot with a second y-axis is https://rpubs.com/MarkusLoew/226759 In this example, the author uses two colors for the two lines, but the line shapes are the same -- both are solid. Could each line have its own color as well as its own shape? For example, can I make the red line with the linetype "twodash", while the blue line with the
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 =
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
2018 May 23
1
legend order in ggplot2
Hi, I ran your code, but the results were not as expected. After I ran the code by "source", it return No id variables; using all as measure variables > p2 and no line or legend is on the graph (as attached) Am I doing anything wrong? John library(ggplot2) library(reshape2) dfm<-melt(df) dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
2018 May 22
0
legend order in ggplot2
Hi Your approach seems to me rather complicated. I would reshape data before plotting and maybe also change order of levels in resulting variable factor library(reshape2) dfm<-melt(df) dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)]) p2<-ggplot(dfm, aes(x=rep(1:2,4), y=value)) p2+geom_line(aes(linetype=variable))+
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),
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:
2018 May 23
3
Change the legend order by order function
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_c", "name_a". I'd like to legend to present in the order: the "name_b" at the top, and "name_a" at the bottom. Could it be done by order function or its inverse?
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
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 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 =
2010 Dec 08
1
ggplot - line_range help, second tier axis label
Hi All, Will try and keep brief, excuse the poor graphics skills, first time using GIMP. I would like to make the first one look (somewhat) like the second if possible. From: http://d.imagehost.org/0519/Screen_shot_2010-12-08_at_3_50_23_PM.png To here: http://d.imagehost.org/0293/Screen_shot_2010-12-08_at_3_50_23_PM2.png I imagine the line going over the top with the p-values is probably not
2018 May 23
0
Change the legend order by order function
There are two key concepts you seem to be unaware of regarding ggplot: 1) you really need to put your data in long format to work with multiple curves, and 2) the column containing the names of the curves should be a factor with levels in the order you wish them to be presented in the legend (bottom to top). I am not in a position at the moment to give you a full reprex, but Google can probably