Message-ID: <CAN5afy81J-G=sDLiApf8ygn4Wa294cX+x2d=oGc3rPTBvoLYmw@mail.gmail.com>
Date: 2016-08-02T22:21:16Z
From: lily li
Subject: plot many dfs in ggplot
In-Reply-To: <CAN5afy_de9kE8N+GiM+wN0HGryYdd=gNkb-Eh1=17yxdc6y5ng@mail.gmail.com>
Another question is, if I want to shade the range between the maximum and
minimum values for daily or annual values, how to do it? Thanks again.
On Tue, Aug 2, 2016 at 12:50 PM, lily li <chocold12 at gmail.com> wrote:
> 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]]