Displaying 20 results from an estimated 500 matches similar to: "Choosing colours for lines in ggplot2"
2023 Jul 23
1
col2rgb() function
Does adjustcolor() help?
cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
"#D55E00", "#CC79A7")
plot(0,0,xlim=c(1,8),ylim=c(0,1))
points(1:8,rep(0.5,8),col=cb8,pch=19,cex=2)
points(1:8,rep(0.75,8),col=adjustcolor(cb8, alpha.f = 0.3), pch=19,cex=2)
On 2023-07-23 2:15 p.m., Nick Wray
2023 Jul 23
2
col2rgb() function
Thanks That works nicely Nick
On Sun, 23 Jul 2023 at 19:26, Ben Bolker <bbolker at gmail.com> wrote:
> Does adjustcolor() help?
>
> cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
> "#D55E00", "#CC79A7")
> plot(0,0,xlim=c(1,8),ylim=c(0,1))
>
2023 Jul 23
2
col2rgb() function
Hello I have a palette vector of colour blind colours (in hexadecimal)
which I?m using for plots, but they are not see-through, and as I wanted to
overlay some histograms I wanted to convert these colours to rgb, when you
can set the opacity.
I have found the function col2rgb(), which works in the sense that it gives
a vector of numbers but these don?t work directly in rgb because they are
too
2023 Jul 23
1
col2rgb() function
Just one addition which may or may not be useful: The color palette you
use is also known as "Okabe-Ito" and it is the default set of colors in
the palette.colors() function. This function also has an optional alpha
argument. So if you want to generate these colors with an alpha of 0.3 you
can also do:
palette.colors(8, alpha = 0.3)
or more explicitly
palette.colors(8, palette =
2023 Jul 23
1
col2rgb() function
Nick,
I've also made colors transparent by pasting the hex equivalent of, say,
0.3*256 = 76.9 to the hex color code. e.q. for black it might be
"#0000004d" and the 4d is 77 in hex. That way you don't need to convert
back and forth so much. If col is "#000000" the transparent version is
tcol <- paste0(col,"4d")
This would work in one step on a whole
2017 Jul 12
1
Problem for installing cbPlatte on R Version 3.4.1
On 12.07.2017 12:35, Shanu Singh wrote:
> Hi John,
>
> Thanks for reply ! Sorry It was my mistake. It is *cbPalette. *Basically
> its a R package.
Come on.
- Where do you want to get thsi from?
- What have you tried to do so?
Please re-read the posting guide that helps to ask good questions.
Best,
Uwe Ligges
>
>
> Shanu
>
> On Wed, Jul 12, 2017 at 3:57 PM, John
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
2024 Jul 18
1
ggplot two-factor legend
?s 17:43 de 18/07/2024, Rui Barradas escreveu:
> ?s 16:27 de 18/07/2024, SIBYLLE ST?CKLI via R-help escreveu:
>> Hi
>>
>> I am using ggplot to visualise y for a two-factorial group (Bio: 0 and
>> 1) x
>> = 6 years. I was able to adapt the colour of the lines (green and red)
>> and
>> the linetype (solid and dashed).
>> Challenge: my code
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),
2012 Apr 20
1
ggplot2: Legend title
I'm designing a set of plots intended for a general audience; here's the code for one of them, using the latest version of ggplot:
plot.enr.all <-
ggplot(data=df1, aes(x=HS_GRAD_YEAR, y=Percentage, 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),
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 <-
2020 Jul 28
2
Superponer mapas en ggplot
Buenos días. Tengo dos mapas que hago con ggplot (abajo) y necesito
superponer el 2º al 1º. En el 1º se representa la variable PA, binomial (0,
1), en gris, y en el 2º la variable ExtTG7085, que es numérica y va de 0 a
200. La 2ª es un gradiente en rojo. Lo ideal sería que donde coinciden el
rojo de la 2ª se viera más oscuro, pero supongo que eso no es fácil. Podría
también ser en otro color, pero
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
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 =
2024 Jul 18
1
ggplot two-factor legend
?s 16:27 de 18/07/2024, SIBYLLE ST?CKLI via R-help escreveu:
> Hi
>
> I am using ggplot to visualise y for a two-factorial group (Bio: 0 and 1) x
> = 6 years. I was able to adapt the colour of the lines (green and red) and
> the linetype (solid and dashed).
> Challenge: my code produces now two legends. One with the colors for the
> group and one with the linetype for the
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:
2024 Aug 16
2
boxplot notch
Thanks Ben,
Here the reproducible example.
It works without notch=TRUE, but provides an error with notch=TURE
Error in `geom_boxplot()`:
! Problem while converting geom to grob.
? Error occurred in the 1st layer.
Caused by error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`:
! replacement has length zero
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In
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 =
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