Bug 16983 - grid.cap captures incorrect colors
Summary: grid.cap captures incorrect colors
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R 3.3.*
Hardware: x86_64/x64/amd64 (64-bit) OS X El Capitan
: P5 major
Assignee: R-core
Depends on:
Reported: 2016-07-08 17:47 UTC by Ted Toal
Modified: 2016-07-18 22:56 UTC (History)
2 users (show)

See Also:

Sample R code illustrating bug (4.14 KB, text/plain)
2016-07-08 17:47 UTC, Ted Toal
Screen shot after running code in attached comment. (584.55 KB, image/png)
2016-07-18 22:48 UTC, Ted Toal
.png file created by previous attachment's R code in comment (18.38 KB, image/png)
2016-07-18 22:49 UTC, Ted Toal

Note You need to log in before you can comment on or make changes to this bug.
Description Ted Toal 2016-07-08 17:47:35 UTC
Created attachment 2116 [details]
Sample R code illustrating bug

grid.cap() returns a matrix of colors that are incorrect.  In my example case, black colors are returned as "red" in the matrix.

Attachment shows the example given in ?grid.cap documentation.  table(cap) shows that most common color is white (correct) and second most common is red (incorrect, should be black).  Adding some more black to the device by writing a large black "X" and then repeating grid.cap() and table() shows that the "red" color count has increased.

My R is 3.3.1, not 3.3.0.
Comment 1 Paul Murrell 2016-07-18 21:43:03 UTC
Can you please run something like ...


... and post the resulting PNG file, PLUS a screen capture (e.g., via alt-prtscn or however you do it on your system, other than with R) of the R graphics window ?
Comment 2 Ted Toal 2016-07-18 22:48:15 UTC
Created attachment 2128 [details]
Screen shot after running code in attached comment.

dev.new(width=0.5, height=0.5)
cap = grid.cap()
Comment 3 Ted Toal 2016-07-18 22:49:27 UTC
Created attachment 2129 [details]
.png file created by previous attachment's R code in comment

This .png file shows "hi" in red, whereas the screenshot attachment shows the window where the word "hi" is in black.
Comment 4 Ted Toal 2016-07-18 22:56:10 UTC
Oops, sorry, the .png file attachment has the incorrect name, it says bug-16987. However, it is the correct file and is the bitmap result for THIS bug, 16983.