Reputation: 89
I am working on custom ggplot2 items and want to compute the size of the actual plot without the margins.
Suppose this plot
ggplot(mtcars, aes(x = cyl, y = hp )) + geom_point() + ggtitle('test') + theme_bw()
I need to retrive the length (relative or absolute) of the margins (see red lines) or somehow the size of the plot and its relative position to the top left corner.
Is there any way to retrieve this info from the ggplot2 object?
Upvotes: 1
Views: 692