ed Tim Umbach <tim.thomas.umb...@gmail.com> schrieb am Fr., 15. Aug. 2025, 17:28:
> > <r-help-requ...@r-project.org> schrieb am Do., 14. Aug. 2025, 12:00: > >> Send R-help mailing list submissions to >> r-help@r-project.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://stat.ethz.ch/mailman/listinfo/r-help >> or, via email, send a message with subject or body 'help' to >> r-help-requ...@r-project.org >> >> You can reach the person managing the list at >> r-help-ow...@r-project.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of R-help digest..." >> Today's Topics: >> >> 1. How to use RColorBrewer in ggplot2? (Luigi Marongiu) >> 2. Re: How to use RColorBrewer in ggplot2? (Marttila Mikko) >> >> >> ---------- Forwarded message ---------- >> From: Luigi Marongiu <marongiu.lu...@gmail.com> >> To: r-help <r-help@r-project.org> >> Cc: >> Bcc: >> Date: Thu, 14 Aug 2025 07:25:20 +0200 >> Subject: [R] How to use RColorBrewer in ggplot2? >> Hello, >> I would like to define a color range to custom color some plot, >> specifically made in ggplot2 (but also for normal plots). >> I have been trying to use RColorBrewer but I don't get any value out >> of this function. I expected it would create a vector of color values, >> but I must be missing something. >> What is the correct you of this function? >> Thank you. >> >> EXAMPLE >> ``` >> set.seed(50) >> df = data.frame(x = runif(15, 0, 1), >> y = x^2 + runif(15, 0, 1), >> z = rep(1:5, 3)) >> library(ggplot2) >> library(RColorBrewer) >> ggplot(df, aes(x=x, y=y, colour=z, group=z)) + >> geom_point(size=4) + >> scale_fill_brewer(palette = "Paired") >> ``` >> >> >> -- >> Best regards, >> Luigi >> >> >> >> >> >> ---------- Forwarded message ---------- >> From: Marttila Mikko <mikko.martt...@orionpharma.com> >> To: Luigi Marongiu <marongiu.lu...@gmail.com>, r-help < >> r-help@r-project.org> >> Cc: >> Bcc: >> Date: Thu, 14 Aug 2025 08:00:40 +0000 >> Subject: Re: [R] How to use RColorBrewer in ggplot2? >> Hi Luigi, >> >> As you map z to colour, you need scale_colour_brewer, not the fill >> version. >> And to get discrete colours, you need to make z discrete. A separate group >> mapping isn't needed in this case. Try this: >> >> ggplot(df, aes(x=x, y=y, colour=factor(z))) + >> geom_point(size=4) + >> scale_colour_brewer(palette = "Paired") >> >> Best, >> >> Mikko >> >> -----Original Message----- >> From: R-help <r-help-boun...@r-project.org> On Behalf Of Luigi Marongiu >> Sent: Thursday, 14 August 2025 06:25 >> To: r-help <r-help@r-project.org> >> Subject: [R] How to use RColorBrewer in ggplot2? >> >> Hello, >> I would like to define a color range to custom color some plot, >> specifically made in ggplot2 (but also for normal plots). >> I have been trying to use RColorBrewer but I don't get any value out of >> this function. I expected it would create a vector of color values, but I >> must be missing something. >> What is the correct you of this function? >> Thank you. >> >> EXAMPLE >> ``` >> set.seed(50) >> df = data.frame(x = runif(15, 0, 1), >> y = x^2 + runif(15, 0, 1), >> z = rep(1:5, 3)) >> library(ggplot2) >> library(RColorBrewer) >> ggplot(df, aes(x=x, y=y, colour=z, group=z)) + >> geom_point(size=4) + >> scale_fill_brewer(palette = "Paired") >> ``` >> >> >> -- >> Best regards, >> Luigi >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> https://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> >> This e-mail transmission may contain confidential or legally privileged >> information that is intended only for the individual or entity named in the >> e-mail address. If you are not the intended recipient, you are hereby >> notified that any disclosure, copying, distribution, or reliance upon the >> contents of this e-mail is strictly prohibited. If you have received this >> e-mail transmission in error, please reply to the sender, so that they can >> arrange for proper delivery, and then please delete the message from your >> computer systems. Thank you. >> >> >> _______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> https://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.