0

enter image description here

While running a ggplot function on R my x-axis ticks are coming out like this and I dont know how to fix it. My goal is for it to be in 0;10 intervals. Here is the code im currently running

ggplot(DFEco, aes(x = Dinero.Gastado..M.de.Euros. , y = Puntos.Totales, 
                  label = Equipo, color = Equipo, show.legend = F)) +
  geom_point(show.legend = F)+
  geom_text_repel(aes(label = Equipo), show.legend = F)+
  labs(y = "Puntos", x = "Dinero Gastado") 
Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32
  • 2
    Guessing that the x-axis values might be of type character or factor rather than numeric (what does `str(DFEco)` say ?) but difficult to know without seeing example data - copy/paste the output of `dput(DFEco)` or `dput(head(DFEco), 10)`. – neilfws Nov 03 '20 at 03:10
  • 1
    It's likely your data is in the wrong format. What is the `class()` if your x-axis? Looks like it may be a factor rather than a numeric value. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Nov 03 '20 at 03:10
  • Ok so the x-axis values are indeed in the factor form, can you help me in transforming this to a numeric? What I want to do is transform a column of the dataframe (DFEco) to a numeric instead of factor – Mateo Caliz Nov 03 '20 at 03:19
  • `as.numeric(as.character(DFEco$Dinero.Gastado..M.de.Euros))`. See https://stackoverflow.com/questions/3418128/how-to-convert-a-factor-to-integer-numeric-without-loss-of-information – Dave2e Nov 03 '20 at 03:58

0 Answers0