Error: Continuous value supplied to discrete scale

The following code is returning the error of the title. The strange thing is that I am running the same code for other tables (those other tables has the same variables) and everything is ok.

p14 <- is_1970_2 %>%
ggplot() +
geom_line(aes(year, f_rel_is, colour = countryname)) +
geom_smooth(aes(year, f_rel_is, color=d_man)) +
gghighlight(max(f_rel_is)>0) + labs(subtitle = "Normal deindustrialization", y="Is Factor", x="Year") + coord_cartesian(ylim=c(-3,10))

p14 <- is_1970_2 %>%

  • ggplot() +
  • geom_line(aes(year, f_rel_is, colour = countryname)) +
  • geom_smooth(aes(year, f_rel_is, color=d_man)) +
  • gghighlight(max(f_rel_is)>0) + labs(subtitle = "Normal deindustrialization", y="Is Factor",
  •                                   x="Year") + coord_cartesian(ylim=c(-3,10))
    

label_key: countryname

p14
geom_smooth() using method = 'loess' and formula 'y ~ x'
geom_smooth() using method = 'loess' and formula 'y ~ x'
Erro: Continuous value supplied to discrete scale
geom_smooth() using method = 'loess' and formula 'y ~ x'
geom_smooth() using method = 'loess' and formula 'y ~ x'
Error: Continuous value supplied to discrete scale

Then most likely the problem is with your specific dataframe, so for us to been able to help you, we need a reproducible example including sample data.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.