0

Hi I have this code which is working ok, but when I try show the data label I have an error that I don't know how to solve.

Error: Discrete value supplied to continuous scale

This code is ok.

ggplot(Datos_3.1, aes(x=reorder(Empresa, Monto), Empresa)) + 
  geom_bar(stat = "identity", aes(y=Monto/1000000), color="blue", fill="lightblue") + 
  coord_flip() + 
  labs(y="Monto CLP $ MM", x="", title="Ingreso por empresa, T2 2021")

This code have the error.

ggplot(Datos_3.1, aes(x=reorder(Empresa, Monto), Empresa)) + 
  geom_bar(stat = "identity", aes(y=Monto/1000000), color="blue", fill="lightblue") + 
  coord_flip() + 
  labs(y="Monto CLP $ MM", x="", title="Ingreso por empresa, T2 2021") + 
  geom_label(aes(label=round(Monto/1000000, digits = 0)))

I have the same proble if I try with geom_text()

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

0 Answers0