I'm making plots in batch mode. While reviewing the graphs, it would be useful to zoom in on serval areas of interest. Is there a way to zoom / rescale axis after the plot is made, and then restore it back to original axis range?
Answer, after incorporating feedback and comments....
set.seed(5)
gplist<-list()
for (i in seq(1,29)) {
mod_evt = paste("plot",i)
df <- data.frame(x=runif(10), y=runif(10))
gp <- ggplot(df,aes(x=x,y=y)) + geom_line() + geom_point() +
labs(title = mod_evt, x="X", y="Y")
print(gp)
gplist[[i]] <- gp
}
I'd like to zoom in on that dip near x=0.52 in plot 27
print(gplist[[27]] + coord_cartesian(xlim= c(.5,.6)))
This reproduces the plot with x axis zoomed in between .5 and .6.