Use this to extract x and y ranges from ggplot, dealing with changes in version

getPlotRanges(h)

Arguments

h

a ggplot object

Value

a list of x and y ranges