Boxplot of ggplot2 giving error (does not make the boxes, only a few points with some scratches), how to fix? OBS: I made other graphics and it worked, only the one stuck

Asked

Viewed 161 times

0

boxef <- ggplot (effectsize, aes(subordemfam, varbiom.efs, colour = classe2))  

boxef + geom_point() + geom_boxplot() + 
  xlab("Táxon") + ylab("Effect Size na Variação de Biomassa") + theme_bw() + 
  geom_hline (yintercept = 0) +
  theme(plot.title = element_text(lineheight=.8, face="bold")) +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())

Nor does geom_hline appear, look:

O que deveria ser um boxplot, mas com traços nos valores

The boxplot would separate between my rate and your body size (small and large, stored in classe2), creating two boxplots for each taxon, with Effect size values on the vertical axis.

My dataframe is correct, having been used successfully in the making of other graphics.

  • 3

    Welcome to Stackoverflow Brasil! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please, take a look at this link and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.

  • 1

    What str(effectsize) shows? But best is a playable example.

  • 1

    Edit the question with the output of dput(effectsize), please. Or, if the data.frame is too large, with dput(head(effectsize, 30)).

  • @Marcusnunes Just now I noticed: Welcome to Stackoverflow Brasil! Calm down, I am Portuguese :).

1 answer

0

Your variable varbiom.efs is as character, you need to turn it into numeric (or correct the data, in last case). Put this code before your call ggplot:

effectsize$varbiom.efs <- as.numeric(effectsize$varbiom.efs)
  • If that’s what it will be as.numeric(as.character(effectsize$varbiom.efs)).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.