I am trying to implement the viridis package using viridis:: + scale_fill_viridis().
This is my code:
ggplot(combi_plot, aes(x = day_of_symptoms, y = ct_value)) + geom_smooth(aes(colour=gender)) +
xlim(-5,20) + scale_fill_viridis()
However, this probably interferes with my use of aes(colour=gender), which draws a seperate line for the two genders in my dataset, using 2 different colours of the ggplot2 basic palet.
My question is: How do you use a custom color palette such as viridis, in combination with the aes(colour="variable") argument.
Cheers
So, it's a little difficult to do this without your data. I'm also not entirely sure what, specifically, you're trying to color. I'm assuming it's the gender.
I set a color palette (I like wespalette, so here's a wespalette example, but you could do the same with virdis, getting a vector of specific colors you want to use).
Then, I pull out the colors I want to use. Rather than the scale_..._virdis, you might want to try the built in functions.
Also, might have to move the color outside of the aes, but I'm not sure what the structure of your data is, so your mileage may vary. So, potentially start tinkering with something like: