Hi all,

I have another question. There are several dataframes, each has the same
columns: time, varA, varB, varC, etc. If I want to plot time ~ varA of each
dataframe, where different dataframe names use different colors. How to do
this in ggplot? Thanks for your help.

Right now, I tried to use the code below, but very laborious, and needs
colors manually.

fig1 = ggplot()+
    geom_path(data=df1, aes(x=time, y= varA, color= 'df1'))+
    geom_path(data=df2, aes(x=time, y= varA, color= 'df2'))+
    geom_path(data=df3, aes(x=time, y= varA, color= 'df3'))+
    ...
    scale_color_manual('', limits=c('df1', 'df2', 'df3', ...),
values=c('blue', red', 'green', ...))
show(fig1)

        [[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 http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to