Bug 15189 - Copying a Graphics Window Copies All Graphic Elements Rather Than Bitmap
Summary: Copying a Graphics Window Copies All Graphic Elements Rather Than Bitmap
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Mac GUI / Mac specific (show other bugs)
Version: R 2.15.0
Hardware: Other Mac OS X v10.8
: P5 major
Assignee: Simon Urbanek
URL:
Depends on:
Blocks:
 
Reported: 2013-01-30 20:55 UTC by Robert Lane
Modified: 2013-01-30 20:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Lane 2013-01-30 20:55:58 UTC
When I copy a plot in a Quartz window that was created with R (r-project.org), all elements are copied and pasted as discrete entities rather than an image (e.g., bitmap, png, etc.). This is very slow when there are many elements in a plot. Pasting the elements into an email also takes a long time because each element is also treated as a discrete element. Attemping to read such an email is painful because it takes a long time to render. This is especially true when the email contains many such plots. The time required to copy, paste, and render is dependent on the complexity (number of elements) in the plot. For example, a histogram is very fast because it has few elements.

Negative consequences of copying graphic elements rather than the image (i.e., bitmap, png, etc.) are bloated email that may not be deliverable, extreme slowness to render mail, consuming large quantities or memory (selecting a 174MB email results in an excess of 16GB RSS), inability to print email with six or seven graphics, etc.

MS Windows copies plots as a bitmap. This is much faster to copy, paste, and render.

To create the problem, follow these steps:
1. Download  R for Mac from www.r-project.org.
2. Install R.
3. Start R.
4. Enter this line to create a plot with many elements: plot(rexp(2000000,0.25),rexp(2000000,0.25),cex=0.5,pch=20)
5. Select the window with the plot. Be patient.
6. Copy the contents of the window (command-C).
7. Paste the clipboard buffer into the body of an email. Be patient.
8. Send the email to someone (yourself).
9. Select the email for reading. Be patient as the plot is rendered.
10. Create a histogram with a large dataset: hist(rexp(2000000,0.25),col='cyan')
11. Repeat steps 6-9. Please notice that these steps are much faster because the elements in the plot are much fewer.

You can try the same procedure for MS Windows. It is much faster than the Mac implementation and does not have the negative consequences mentioned above.

I have communicated with the Core Graphics team at Apple. They report, "This is something that the app is doing, not something that [Apple] control[s]."

One can work around the performance issue by taking a screenshot of the window. This requires more manual steps and much more time consuming than a simple copy, and paste sequence.