problem when i create a ggplot

Hi i hace a problem with a ggplot 2 i have upload an excel and i dont know why in the x and y axis dont show variables names only show the value of the column, i add a picture of what i mean

Hi @carlosg7, it looks like there is a space that shouldn't be there in your x-axis aes() assignment.

Nomber_ del_articulo vs Nombre_del_arcticulo could be the issue here.

1 Like

hi i try but still dont go i dont understand why. Its possible because both t r studio detect its a character not a number? Thank you

Hi @carlosg7,
Maybe you need put like a factor and next try the plot and check the variables names:

analytcs_r11$Nombre_del_articulo <- as.factor(analytcs_r11$Nombre_del_articulo)
# next make the plot

Hi Carlos G7!

Please, copy and paste any of these:

Code 1:

analytcs_r11 %>% ggplot(aes(Articulos_vistos, Nombre_del_artĂ­culo))+

Code 2:
analytcs_r11 %>% ggplot(aes(Articulos_vistos, Nombre_del_artĂ­culo))+


hi i add but still dont go :smiling_face_with_tear:

Hi @carlosg7 ,

You could try the parse_number function.

analytcs_r11 %>% 
    ggplot(aes(Articulos_vistos, Nombre_del_artĂ­culo))+

run this:

analytcs_r11 %>% ggplot(aes(ArtĂ­culos_vistos, Nombre_del_artĂ­culo))+


analytcs_r11 %>% ggplot(aes(ArtĂ­culos_vistos, Nombre_del_artĂ­culo))+

I changed: Articulos_vistos to ArtĂ­culos_vistos (tilde)

hi @carlosg7 @bustosmiguel ,

the Ă­ with the accent could be also a problem no ?
You should clean names before to analyses the data.

# Create fake data but similar to yours
analytcs_r11<-tibble(ArtĂ­culos_vistos=c("1","2"),# colum name with accent, data of character types

# ggplot 
analytcs_r11_v2<-analytcs_r11 %>% 
  janitor::clean_names() %>% # 1 clean the colum name (here accents where removed as well as caps)
  mutate(articulos_vistos=parse_number(articulos_vistos)) %>% # 2 character converted to double
  ggplot(aes(articulos_vistos, nombre_del_articulo))+ # 3 create ggplot
  labs(x="Articulo visto", y="Nombre del articulo") # 4 change the x and y axis title

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.