ggplot(data = mntd,aes(x = div, y = NTI,)) +
geom_point() +
theme_base() +
xlab("Plant species richness")
as you can see, I use theme_base() to plot, then I export it as an image. However, this ".png" file has three black borders (top, bottom and left), maybe you need to insert it into powerpoint for better observation.
I wonder how to remove these black borders.
suppressPackageStartupMessages({
library(ggplot2)
})
ggplot(data = mtcars,aes(x = cyl, y = mpg)) + # trailing comma is unnecessary
geom_point() +
xlab("Plant species richness") + # generally better to put theme last
# theme_base() # there is no theme_base in the ggplot2 package
theme_classic() # this is the theme that reproduces the problem
Try theme_minimal, which eliminates the border. Come back with a separate question if you also want "How to eliminate grid lines from ggplot?"