3
The code below generates a graph of lines whose colors are automatically set to blue and red:
ggplot(aes(x = factor(year), y1 = auto_course_choice, y2 = auto_hire, group=country)) +
geom_line(aes(y = auto_course_choice, colour = "autonomy course decision")) + facet_wrap(~ country, ncol = 7) +
theme_bw()+
geom_line(aes(y = auto_hire, colour = "autonomy hiring teachers")) +
facet_wrap(~ country, ncol = 7) +
theme_bw()
How it is possible to change the colors of the lines generated by geom_line()
on a chart ggplot2?
Hello Michelle, you need to specify which colors you want to change? the line color? The background color? If it is clearer, your question is more likely to be answered.
– Daniel Falbel
ok, thanks! I want to change the color of the lines of the chart that looks are automatic to blue and red!
– Michelle Resende
Can you please, edit the question with the departure of
dput(dados)
or, if the base is too large,dput(head(dados, 20))
? Note:dados
is the base name, for example a data frame..– Rui Barradas
@Noisy sure you need it to answer the question?
– Daniel Falbel
@Danielfalbel Absolutely necessary maybe not, I can create a data set. But you’ve seen the color in the code above?
colour = "autonomy hiring teachers"
is not an absolute certainty base variable.– Rui Barradas
@Danielfalbel Also missing the argument
data
inggplot()
.– Rui Barradas
That’s why she is forcing the color straight. I wanted to open the question even...
– Daniel Falbel
Can’t reopen after she commented it’s the lines generated by
geom_line()
?– Tomás Barcellos
Or indicate this question as already containing the answer... (@Danielfalbel and @Ruibarradas)
– Tomás Barcellos
Yes, but it needs 5 votes to reopen. I think this question answers only the gradient, hers is a categorical scale.
– Daniel Falbel
Can use
colour = c("blue", "red")
. But what is there is not a color name. That seems to be the main problem. Anyway, I will vote to reopen.– Rui Barradas