Search code examples
rggplot2boxplotaxis-labels

ggplot boxplot labels not showing


I am creating a boxplot and can get the plot to show, but the x and y axis ticks and labels do not show up. This occurs with my own data as well as with example data. Here is the example data (from http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/:

bp <- ggplot(PlantGrowth, aes(x=group, y=weight)) +
  geom_boxplot()
bp

And the resulting figure

figure from example data

Setting the discrete x axis doesn't change anything either

bp + scale_x_discrete(limits=c("trt1","trt2","ctrl"))

results in changing the order of the boxplots but no labels show. Why aren't the ticks and labels showing up and how do I get them to show?


Solution

  • Question was solved in the comments by @chemdork123 but wanted to post the answer here to close the question. I uninstalled all of the packages but the base and recommended packages, following the instructions found here https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/. After uninstalling all packages, I reinstalled ggplot2 and the captions appeared. After reinstalling each previous problem one by one I learned ggtern was the issue here. Removing ggtern and reinstalling ggplot2 again fixed the issue and code runs perfectly.