I recently noticed that when I try plotting anything in ggplot2, both the x and y axes data (values, labels, lines, everything) are missing. I have tried to manually specify and enter the missing data using scale and theme commands, but ggplot still won't display the axes.
For example, the following simple code produces this plot on my computer:
ggplot(mpg, aes(x=class,y=hwy)) + geom_boxplot()
I have been using R and ggplot regularly for a few years and never encountered this problem until recently, but I don't know what computer/R/ggplot settings could have changed.
Interestingly, when I use base plotting functions there are no issues (both axes plot normally), so it seems like it's only an issue in ggplot.
E.g., the base code below produces this plot on my computer:
boxplot(mpg$hwy ~ mpg$class)
I have tried uninstalling and reinstalling ggplot multiple times to no avail.
Any advice for how to fix ggplot? Thanks!
I know this is 5 years old, but I had the problem today. Lines, grids, and ticks in ggplot were suddenly missing. The reason was not on ggplot2, but on my office screen settings. Apparently, some screens render thin lines so that they disappear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With