I am trying to make a plot with no information beyond the data. No axes; no grid; no title; just the plot.
But I keep getting extra margins and padding that I can\'t
From ggplot2_2.0.0 you can use theme_void
:
ggplot() +
geom_area(data = economics, aes(x = date, y = unemploy), linetype = 0) +
theme_void()
Here is the way to plot only the panel region:
p <- ggplot() + geom_area (data=economics, aes(x = date, y = unemploy), linetype=0) +
scale_x_date(expand = c(0,0)) + scale_y_continuous(expand = c(0,0)) +
theme(line = element_blank(),
text = element_blank(),
title = element_blank())
gt <- ggplot_gtable(ggplot_build(p))
ge <- subset(gt$layout, name == "panel")
grid.draw(gt[ge$t:ge$b, ge$l:ge$r])
try
last_plot() + theme(axis.ticks.length = unit(0.001, "mm")) + labs(x=NULL, y=NULL)
you may want to file a bug for the 0 tick length.