search for: scale_color_manual

Displaying 20 results from an estimated 31 matches for "scale_color_manual".

Did you mean: scale_colour_manual
2023 Aug 02
2
Choosing colours for lines in ggplot2
...df ggplot(df,aes(Year,Flow,group=Stat,colour=Stat))+ coord_cartesian(ylim = c(0, 10)) + geom_line()+ geom_point() ## this works ## BUT: ## code 2 col.2<-cb8[4:5] ggplot(df,aes(Year,Flow,group=Stat,colour=Stat))+ coord_cartesian(ylim = c(0, 10)) + geom_line()+ geom_point()+ scale_color_manual(values =cb8[4:5])+ theme_bw() ## this gives error message Error: Continuous value supplied to discrete scale ## However this example using code from the net does work so I don't understand why my ## second code doesn't work. ## code 3 df.1 <- data.frame(store=c('A', 'A&...
2017 Jun 30
0
Multiple "scale_color_manual" statements in one plot (ggplot2, flexible legend challenge)
...but not for the lines. Attached the sample code and sample data. I tried to add "color" arguments to the "geom_smooth" and "geom_line" and doesn't work. I think the problem is I need to separate the color schemes for lines and points, but I can't use multiple scale_color_manual statement in one ggplot. Jun Shen ####sample data######### df1 <- structure(list(Y2 = c(0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L), X = c(27L, 8L, 33L, 53L, 100L, 52L, 9L, 60L, 50L, 10L, 3L, 30L, 50L, 15L, 90L, 48L, 110L, 75L, 72L, 150L, 47L, 30L),...
2020 Oct 23
5
How to shade area between lines in ggplot2
...olNum] head(trainset); str(df) svm_model<- svm(z ~ ., data = trainset, type = "C-classification", kernel = "linear", scale = FALSE) #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + geom_point() + scale_color_manual(values = c("red", "blue")) # show decision boundaries w = t(svm_model$coefs) %*% svm_model$SV # %*% = matrix multiplication slope_1 = -w[1]/w[2] intercept_1 = svm_model$rho / w[2] p = p + geom_abline(slope = slope_1, intercept = intercept_1) ### here we go: can I use a shaded a...
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), color="purple", size=4, alpha=0.5) # show hyperplane (decision boundaries are off set by 1/w[2]) w = t(svm_model$coe...
2020 Oct 23
0
How to shade area between lines in ggplot2
...l<- svm(z ~ ., > data = trainset, > type = "C-classification", > kernel = "linear", > scale = FALSE) > > #! plot > p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + > geom_point() + scale_color_manual(values = c("red", "blue")) # show > decision boundaries w = t(svm_model$coefs) %*% svm_model$SV # %*% = > matrix multiplication > slope_1 = -w[1]/w[2] > intercept_1 = svm_model$rho / w[2] > p = p + geom_abline(slope = slope_1, intercept = intercept_1) ### here we...
2013 Apr 03
7
Canadian politcal party colours in ggplot2
A stupid question but does anyone know how to express the actual colours used by the main Canadian political parties? I want to do a couple of ggplot2 plots and have lines or rectangles that accurately reflect the party colours. I can probably play around with RColorBrewer or something to figure it out but if some some already has got them it would save me some time especially with the NDP
2020 Jul 28
2
Superponer mapas en ggplot
...niendo el gradiente. He pensado, también, en crear una nueva variable, combinación de las dos, que me permitiera hacer eso mismo, pero no encuentro la forma. Gracias por vuestra ayuda, una vez más, Manuel ggplot(legend=FALSE)+ geom_point(data=NCDS,aes(x=lon,y=lat,color= PA),shape=15,size=1) + scale_color_manual(values=c("white","grey70"))+ geom_path(data=map_data('world'), aes(x=long, y=lat,group=group)) ggplot(legend=FALSE)+ geom_point(data=NCDS,aes(x=lon,y=lat,color= ExtTG7085),shape=15,size=1) + # PTP o FTP scale_colour_gradient2(low = "white",high="RED...
2012 Apr 20
1
ggplot2: Legend title
...entage, group=Enrolled_by, color=Enrolled_by, shape=Enrolled_by, fill=Enrolled_by)) + geom_line() + geom_point(size=3.5) + scale_y_continuous(breaks=seq(0, 100, 10), limits=c(0, 100), labels=paste(seq(0, 100, 10), "%", sep="")) + scale_color_manual(values=c("orange", "red"), breaks=c("PCT_ENR_FALL1", "PCT_ENR_FALL2"), labels=c("1st fall", "2nd fall")) + scale_fill_manual(values=c("orange", "red"), bre...
2012 Oct 22
1
how to group smooth line by two groups?
...group, i need to plot two, one type is solid, the other type is dotted. how to do it? I tried a color plot with the following code. what should i change "color" to? pb <- ggplot(data, aes(x = a, y = b, color = char, linetype = factor(sex))) p0 <- pb + scale_color_manual(values = c("#00FFFF", "#FFFF00", "#00FF00")) + scale_linetype_manual(breaks=c("0","1"), values=c(1,2), labels = c("male", "female")) + geom_smooth(method = "lm", se = FALSE, # Don't add shaded con...
2020 Oct 23
2
How to shade area between lines in ggplot2
...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), > > color="purple", size=4, alpha=0.5) # show hyperplane > > (decision > > bou...
2020 Oct 23
0
How to shade area between lines in ggplot2
...Subject: Re: [R] 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), > color="purple", size=4, alpha=0.5) # show hyperplane > (decision > boundaries are off set by 1...
2020 Oct 26
0
How to shade area between lines in ggplot2
...ines 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), > > > color="purple", size=4, alpha=0.5) # show > > > hyperplane (de...
2017 Aug 04
1
legend and values do not match in ggplot
...are given in the plot do not match with the values specified in the codes given below. Your helps highly appreciated. Greg library(ggplot2) p <- ggplot(a,aes(x=NO_BMI_FI_beta ,y=FI_beta ,color= Super.Pathway))+ theme_bw() +theme(panel.border=element_blank()) + geom_point(size=3) p2<-p+scale_color_manual(name="Super.Pathway", labels=c("Amino Acid", "Cofactors and Vitamins", "Carbohydrate", "Energy", "Lipid", "Peptide", "Nucleotide"), values=c("Amino Acid"="red", "Cofactors and Vitamins"=...
2011 Aug 09
1
ggplot2 setting colors for individual groups.
...or gradient, I would like make the values between A and B a set color, between B and C another color, and so on. That's where I'm having an issue, because the values are all continuous data, and it seems like the only thing which will let me get anything close to what I would like (such as scale_color_manual) requires a discrete dataset. I've reached an impasse with this and could really use some advice. Thanks everyone! A -- Adrienne Wootten Graduate Research Assistant State Climate Office of North Carolina Department of Marine, Earth and Atmospheric Sciences North Carolina State University --...
2011 May 28
1
ggplot pale colors
Hello i am new to ggplot and i observed a strange behavior. I want to display two groups of points, each group with a different color. But i encountered a problem with the colors. Here is a first example: dataset <- data.frame(Main = c("A", "A", "B", "B"), Detail = c( "b", "c", "1", "2"), resp = runif(4, min
2011 Jan 30
2
ggplot2 -- scale_colour_manual()
...uron) huron = data.frame(year=1875:1972,level=LakeHuron) p = ggplot(huron, aes(year)) + geom_line(aes(y= level - 5), colour = 'blue') + geom_line(aes(y= level + 5), colour = 'red') print(p) key = c('below' = "blue", 'above' = "red") p = p + scale_color_manual("Direction", values = key) print(p) > sessionInfo() R version 2.12.1 (2010-12-16) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C...
2012 Jan 12
1
Add color to Boxplot by value
I have a boxplot of Production run rates per 10 minute intervals and I would like to color code them by the average (i.e. >15ppm = green, <9ppm = red, everything else yellow). Is there a way to do this? http://r.789695.n4.nabble.com/file/n4289381/RunRateBoxWhisker.png -- View this message in context: http://r.789695.n4.nabble.com/Add-color-to-Boxplot-by-value-tp4289381p4289381.html Sent
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")) + geom_smooth(method = "lm", se = FALSE, size = 1.5) Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/how-to-add-mean-value-to-regression-line-using-ggplot-tp4646674.html Sent from...
2013 Feb 04
1
ggplot and colors
Hello, I have a problem with ggplot and colors I used this function to draw somes lines and I want them to be all black (just to test) however, I dont get any black line in the figure. Do you have any experience with ggplot and manual colors?? ggplot(cmax, aes(cmax[,3], cmax[,6],colour=interaction(cmax[,1],cmax[,2]))) + geom_line() + geom_point() +
2014 Jun 20
1
zuzufarah Help with ggplot 2 error: Aesthetics must either be length one, or the same length as the dataProblems
WUA_table<-WUA.df[,2:dim(WUA.df)[2]] WUA_discharge<-WUA.df[,1] colour_scheme<-palette(rainbow(dim(WUA_table)[2])) # Main scatterplot p1 <- ggplot(NULL, aes(WUA_discharge,WUA_table)) + geom_line() + scale_color_manual(values=colour_scheme)+ scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + expand_limits(y = c(min(WUA_table) - .1*diff(range(WUA_table)), max(WUA_table) + .1*diff(range(WUA_table)))) + expand_limits(x = c(min(WUA_discharge) - .1*diff(range(W...