jrnold / ggthemes

Additional themes, scales, and geoms for ggplot2
http://jrnold.github.io/ggthemes/
1.31k stars 229 forks source link

Continuous value error on scale_fill_fivethirtyeight() #72

Closed soedr closed 7 years ago

soedr commented 7 years ago

Hi, thanks for the great package. Came across a Error: Continuous value supplied to discrete scale error when trying to use scale_fill_fivethirtyeight() on a df with only string and integer values. scale_fill_viridis() works like charm.

jrnold commented 7 years ago

scale_fill_fivethirtyeight is only for discrete values, while scale_fill_viridis is for continuous values. Even though you may be passing integers to the 538 scale, the vector is probably numeric so ggplot2 thinks it is continuous values. Either convert the vector to an integer using as.integer or a factor, and perhaps explicitly set values of breaks and labels as described in discrete_scale().