R: ggplot2 How to detect plot contents are outside of plot window

Viewed 44

Is it somehow possible to detect programmatically, that a part of the plot is not in the plot window any more?

Take the following code as example - clearly some points are cut off.

df <- data.frame(input = c(rep(3,100), runif(200)))   
ggplot(data = df, aes(x = input)) + geom_dotplot( )

enter image description here

If I increase the height of the plot window - more and more points become visible. Does this mean, that the information for these additional objects is somehow available in the plot object and just not displayed, because it doesn't fit in the window?

I've found layer_data(gg,1) - but nothing in there seems like the information I need.

How could I access this information (in order to adjust plot window size accordingly)?

0 Answers
Related