title: Legend in aes_string for a Loop rstudio
body: <p>I have a problem with displaying the legend on the chart.
  Using aes_string does not appear to me. Could you help me to show some kind of legend on the chart?</p>
  <p>The data I have is the following:</p>
  <pre class="lang-r prettyprint-override"><code>&gt; head(rev_countries)
               US         China      India      Korea      Taiwan    Alemania     Francia      Espana
  1  0.0016930023 -0.0203939098 0.01132170 -0.1148745 -0.04096485 -0.03902919 0.006571760 0.002196811
  2  0.0016930023 -0.0203939098 0.01132170 -0.1148745 -0.04096485 -0.03902919 0.006571760 0.002196811
  3  0.0016930023 -0.0203939098 0.01132170 -0.1148745 -0.04096485 -0.03902919 0.006571760 0.002196811
  4  0.0075516046 -0.0005587373 0.02947631 -0.1113395 -0.04750715 -0.03585176 0.013940910 0.009494249
  5 -0.0005482551 -0.0122860298 0.01092174 -0.1088372 -0.05022913 -0.04502686 0.003310547 0.002957849
  6 -0.0005482551 -0.0122860298 0.01092174 -0.1088372 -0.05022913 -0.04502686 0.003310547 0.002957849
         Italia         UK        Japon      Brazil      Mexico       date    rev.1m.us rev.1m.China
  1 0.001235253 0.01923392 -0.007952821 0.013958126 0.015917230 2018-12-31 -0.004314109 -0.005530346
  2 0.001235253 0.01923392 -0.007952821 0.013958126 0.015917230 2019-01-01 -0.004314109 -0.005530346
  3 0.001235253 0.01923392 -0.007952821 0.013958126 0.015917230 2019-01-02 -0.004314109 -0.005530346
  4 0.008008179 0.02326827 -0.001905986 0.020438684 0.021886192 2019-01-03  0.001509360  0.014605786
  5 0.014848945 0.01061286 -0.007897650 0.006886375 0.007849294 2019-01-04  0.001509360  0.014605786
  6 0.014848945 0.01061286 -0.007897650 0.006886375 0.007849294 2019-01-07 -0.005461343 -0.001674341
    rev.1m.India rev.1m.Korea rev.1m.Taiwan rev.1m.Alemania rev.1m.Francia rev.1m.Espana rev.1m.Italia
  1   0.01445868  -0.06991754   0.008796213    -0.009619475   -0.003276670 -0.0021365882  -0.009794952
  2   0.01445868  -0.06991754   0.008796213    -0.009619475   -0.003276670 -0.0021365882  -0.009794952
  3   0.01445868  -0.06991754   0.008796213    -0.009619475   -0.003276670 -0.0021365882  -0.009794952
  4   0.03266960  -0.06620301   0.001914454    -0.006344804    0.004020380  0.0051292964  -0.003096640
  5   0.03266960  -0.06620301   0.001914454    -0.006344804    0.004020380  0.0051292964  -0.003096640
  6   0.01594724  -0.05313210  -0.013961667    -0.014044431   -0.001934658 -0.0002596428  -0.012555487
       rev.1m.UK rev.1m.Japon rev.1m.Brazil rev.1m.Mexico
  1 -0.009122300 -0.004201523    0.02262443  -0.007001167
  2 -0.009122300 -0.004201523    0.02262443  -0.007001167
  3 -0.009122300 -0.004201523    0.02262443  -0.007001167
  4 -0.005200192  0.001868177    0.02916038  -0.001166861
  5 -0.005200192  0.001868177    0.02916038  -0.001166861
  6 -0.009667177 -0.002055168    0.01891488  -0.008494208
  
  
  </code></pre>
  <p>The code I use is this:</p>
  <pre class="lang-r prettyprint-override"><code>bucle&lt;-list()
  
  for (i in 1:(length(rev_countries1m)-1)) {
  
   
  
    bucle[[i]]&lt;-ggplot(rev_countries)+
  
      geom_line(aes_string(x=&quot;date&quot;,y= names(rev_countries)[i], fill=shQuote(&quot;b&quot;)), size=1.4, color=&quot;midnightblue&quot;)+
  
      geom_line(aes_string(x=&quot;date&quot;,y= names(rev_countries)[i+14], fill=shQuote(&quot;r&quot;)), linetype=&quot;twodash&quot;, size=1.4)+
  
      labs(x= &quot;Date&quot;, y=&quot; 1M, 3M Revisions&quot;, title =names_countries[i] , subtitle = &quot;Next 12 Months EPS&quot;, color=&quot;Legend&quot;)+
  
      guides(color=TRUE)+
  
      scale_fill_manual(name=&quot;s&quot;, guide='legend', values = c(&quot;b&quot;=&quot;black&quot;, &quot;r&quot;= &quot;red&quot;))+
  
      theme_economist()
  
  }
  
   
  
  bucle[[2]]
  
  </code></pre>
  <p>And the graph is this:</p>
  <p><img src="https://i.stack.imgur.com/Y9hso.png" alt="click to see the graph" /></p>
  <p>I would like to add a legend by colors.
  Thanks in advance</p>