Is there a way to enable locator()
functionality in the RStudio plot zoom? This only works in the smaller window (default bottom right) of RStudio but when you click on a viewer already open as a separate window, no coordinates are captured:
plot(iris$Petal.Width, iris$Petal.Length)
locator()
Perhaps the answer here is that is not currently implemented and that is why I couldn't find mention of it online.
I'm using RStudio version 0.99.491.
Thanks in advance.
The keyboard shortcut for zooming a pane is often the same as for moving to the pane, plus the Shift key. So, Ctrl+Shift+2 will zoom the Console; use the same sequence to un-zoom the Console and restore the prior layout.
This does not directly use RStudio's "Zoom" function, but gets pretty close at what you're probably after:
df <- data.frame(1:4)
windows()
plot(df)
locator(1)
A couple of notes:
windows()
, then resize the window, then execute plot(df)
. n
argument for locator()
. Otherwise it will crash your R session because of this bug. (Which hasn't been resolved AFAIK)But if your purpose is to be able to use locator()
on a zoomed version of a plot (i.e. if you have a very crowded plot), this should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With