I'm trying to overlay outlined rectangles on a geom_tile ggplot. Right now I am calling the rectangles using geom_rect
geom_rect(xmin=2, xmax=49, ymin=1, ymax=30, color="black",alpha=0.5, fill=NA, size = 0.3) +
geom_rect(xmin=7, xmax=45, ymin=5, ymax=42, color="black",alpha=0.5, fill=NA, size = 0.3)
The problem is that the line for the edge of the rectangle falls directly in the center of the tile. Essentially, the position of the edge it is acting like
geom_raster(vjust = 0.5, hjust=0.5)
Unfortunately, geom_rect doesn't have hjust
or vjust
parameters. How can I change the position of the rectangle so that the edge of the rectangle falls between cells (as if I was setting hjust = 0
or hjust = 1
and the same for vjust
)?