1

In a continuation of this question

The following works fine:

manipulate({ggplot(map.df, aes_string(x='long', y='lat', group='group', fill=ObesityYear)) + 
    geom_polygon()+coord_map()+ 
    labs(title="2010 Adult Obesity by County, percent",x="",y="")+ 
    theme_bw()}, ObesityYear = picker("obesity09", "obesity10", "obesity13"))

But this produces an error:

manipulate({ggplot(map.df, aes_string(x='long', y='lat', group='group', fill=ObesityYear)) + 
    geom_polygon()+coord_map()+
    scale_fill_gradient("",colours=brewer.pal(9,"YlOrRd"))+
    labs(title="2010 Adult Obesity by County, percent",x="",y="")+ 
    theme_bw()}, ObesityYear = picker("obesity09", "obesity10", "obesity13"))

Error:

Error in continuous_scale("fill", "gradient", seq_gradient_pal(low, high,  : 
  unused argument (colours = c("#FFFFCC", "#FFEDA0", "#FED976", "#FEB24C", "#FD8D3C", "#FC4E2A", "#E31A1C", "#BD0026", "#800026"))
Community
  • 1
  • 1
Pouya Barrach-Yousefi
  • 1,207
  • 1
  • 13
  • 27
  • 2
    You are specifying the colors the wrong way. When using `scale_fill_gradient`, you have to specify a `low` value and a `high` value. See also `?scale_fill_gradient`. – Jaap Oct 27 '15 at 08:48
  • Thanks for pointing me in the right direction: scale_fill_gradientn(colours=brewer.pal(9,"YlOrRd"), guide="colorbar") – Pouya Barrach-Yousefi Oct 27 '15 at 09:20

0 Answers0