New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
locator returns incorrect coordinates #12682
Comments
This is weird, my system has almost the same configuration than yours, but it works well:
I have tried changing the size of the plot panel inside RStudio, but the results are still quite well. |
If you're having issue with locator function then it might be because of the zoom level of the Rstudio or Scale of the windows (Display settings). Change both the zoom levels to 100% as shown: Changing the zoom level of RStudio Go to Tools -> Global Options -> Appearance -> Zoom (change that to 100%) Changing the Scale of Windows Display This happens often in the laptops where the Scale is 150% by default. You have to change that 100%. Right click on windows' desktop, Display Setting -> Scale (change that to 100%) |
|
Setting the scaling on Windows to 100% seems to help some of my package's users, but not completely. RStudio's own zoom setting also contributes. But setting both to 100% does not seem to resolve it for everyone: users are reporting that Windows scaling of 100% and RStudio zoom to 70%-80% produces best results. A larger issue for me is that the behavior is also broken for users on posit.cloud (even on my Mac, where it works on native RStudio). There is no scaling option for RStudio on the cloud platform. |
Same here. I am using RStudio server and there are no 'zoom' option in the 'Appearance'. When I used locator, the coordinates will shift a lot. |
Even setting in RStudio the Zoom Scale to 100%, as suggested by @ronakv10, the locator function produces incorrect positions in RStudio. The exact values depend on the size of the window. As reported by @rhijmans, the bug does not exist in R alone (RGui). As a workaround, we are currently opening an external graphic window, where the locator function is working perfectly:
The fixing of this bug by an upcoming RStudio version would be highly appreciated. |
@segawat can I ask which method you are using to reliably determine the OS to know which of |
@soumyaray I am not sure, if I can properly help you, but a system-independent way of opening an external graphic window from RStudio could be:
Please also check the following discussion on Stack Overflow and maybe the entry on x11() in the R Documentation . |
System details
Steps to reproduce the problem
Description
locator
does not return the correct coordinates in the default R-Studio canvas. This has been reported here before: #8571 and elsewhere. But the issues went stale without resolution or work-around for the default device.This used to work in the past on some version of R-studio, or under some conditions.
locator
works if you first usedev.new("x11")
works but that is tricky and cannot be used in a function that calls locator (it is too late by then). For example, this breaksterra::click
andterra::draw
in R-Studio.The text was updated successfully, but these errors were encountered: