[R] Flickering when scrolling in R graphics windows

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Tue Jan 24 10:50:26 CET 2023


>>>>> Ziyun Tang 
>>>>>     on Sat, 21 Jan 2023 15:14:15 -0500 writes:

    > Hello, I have been experiencing some issues regarding scrolling with
    > the mouse or trackpad in R graphics windows (from the base graphics
    > package), which sometimes results in flickering, and wanted to see if
    > anyone else had the same issues, or any advice. This happens for R
    > version 4.2.2 on Windows 10 x64, and occurs when using Rgui and at the
    > command line (whenever graphics windows are invoked). Note that some
    > of the example code below can cause flickering and can be an issue for
    > those with photosensitive epilepsy.

    > Specifically, I have been experiencing three main issues, as follows:

    > 1. When viewing a dataset with View(), the graphics window flickers
    > when scrolling downwards too quickly, even with the option
    > buffered=TRUE. For example:
    >> View(iris)

If you use [Page Up]  and [Page Down]  there is no "flickering",
also using the cursor (up/down "arrows").
Still here, I would not think anything to be "wrong".
If you tell the computer to refresh a screen more quickly than
makes sense I guess you must expect what you see here.
(but yes, more modern GUIs would do 'smooth scrolling' here; I
 think that's not available for the graphapp GUI in R for Windows)

By "scrolling", what exactly do you mean?
Is it that you use your mouse "wheel"? ...  I assume "yes" in
the following, because in that case I can partly reproduce what
you describe.


    > 2. When viewing a graph with plot(), and scrolling down, the graphics
    > window flickers between the background and the graph itself. For
    > example:
    >> plot(iris$Sepal.Length, iris$Sepal.Width)

At first I wrote
   I don't understand how you can "scroll down" in this plot

but now that I've guessed you mean "mouse wheel scrolling" I can
indeed see what you describe.

    > 3. When viewing a matrix of scatterplots with pairs(), and scrolling
    > down, the graphics window flickers between the background and the
    > individual scatterplots. In some instances, when scrolling down with
    > the trackpad, the window flickers continuously, and subsequently
    > closing the window crashes R. For example:
    >> pairs(iris[1:4])

That you bring R to crash just by "scrolling" really seems a bad
thing and points to a bug.
OTOH, I have not been able to replicate a crash.

I don't know what mouse-wheel-scrolling should do in a graphics window
in R for Windows.
In our terminal server version of Windows,
using Rterm (via ESS = Emacs Speaks Statistics), I can indeed
see that  mouse-scrolling in a graphics window has *very funny*
/ strange effects when using the default interactive graphics
device ( .Device == "windows" ) :

Notably, after say   pairs(iris)    mouse-wheel-scrolling
"kind of" redraws some of the panel plots mostly in full size
(instead of the size they were as panels and as part of the full
"pairs" i.e., scatter plot matrix.

If instead I use RStudio and their own device "RD<something>"
mouse-wheel-scrolling has no effect, e.g., after  pairs(iris).
And "no effect" is clearly better than what we observe with the R
default device "windows" i.e., windows() in the above situation.


    > My sessionInfo() is as follows:

    > R version 4.2.2 (2022-10-31 ucrt)
    > Platform: x86_64-w64-mingw32/x64 (64-bit)
    > Running under: Windows 10 x64 (build 19044)

    > Matrix products: default

    > locale:
    > [1] LC_COLLATE=English_United States.utf8
    > [2] LC_CTYPE=English_United States.utf8
    > [3] LC_MONETARY=English_United States.utf8
    > [4] LC_NUMERIC=C
    > [5] LC_TIME=English_United States.utf8

    > attached base packages:
    > [1] stats     graphics  grDevices utils     datasets  methods   base

    > loaded via a namespace (and not attached):
    > [1] compiler_4.2.2 tools_4.2.2

    > Thank you in advance,
    > Ziyun



More information about the R-help mailing list