Message-ID: <CAN5afy_de9kE8N+GiM+wN0HGryYdd=gNkb-Eh1=17yxdc6y5ng@mail.gmail.com>
Date: 2016-08-02T18:50:41Z
From: lily li
Subject: plot many dfs in ggplot
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]]