I'm having a ggplot spacing problem.. probably just not knowing the exact theme element I'm looking for. when I make a ggplot and remove all axis markings, then make all margins 0, there is still a little bit of space between the panel and the outside of the plot that is making my plot asymmetrical. How do I remove this?
data.frame(x=1,y=1) %>%
ggplot(aes(x=x,y=y))+
geom_point()+
ggthemes::theme_few() +
labs(x=NULL,y=NULL)+
theme(axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank(),
axis.line = element_blank(),
panel.background = element_rect(fill="powderblue",color="black",size=2),
plot.margin = margin(0,0,0,0,"pt"))
see the tiny bit of white space on the left and the bottom. Also, if we move the (nonexistent, I thought) x-scale to the top by adding + scale_x_continuous(position="top")
, the space moves there. So there must be some remnants of scale markings that are creating this space by default. Is there a way to remove it?
Thanks!