r - It is possible to create inset graphs? -
i know when use par( fig=c( ... ), new=t ), can create inset graphs.  however, wondering if possible use ggplot2 library create 'inset' graphs.  
update 1: tried using par() ggplot2, not work.
update 2: found working solution @ ggplot2 googlegroups using grid::viewport().
section 8.4 of the book explains how this.  trick use grid package's viewports.
#any old plot a_plot <- ggplot(cars, aes(speed, dist)) + geom_line()  #a viewport taking fraction of plot area vp <- viewport(width = 0.4, height = 0.4, x = 0.8, y = 0.2)  #just draw plot twice png("test.png") print(a_plot) print(a_plot, vp = vp) dev.off()      
Comments
Post a Comment