Skip to content

image (PR#11493)

9 messages · jms2003 at med.cornell.edu, Henrik Bengtsson, Simon Urbanek +3 more

#
Full_Name: Joseph Scandura
Version: 2.7.0
OS: Mac 10.5
Submission from: (NULL) (140.251.50.94)


Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw
visible boxes around each rectangle in the plot. When there are many rectangles
the surrounding color becomes dominant over the rectangle color and the overall
image is borderline useless.
#
On Tue, May 20, 2008 at 5:05 PM, <jms2003 at med.cornell.edu> wrote:
<sarcasm>
...and so are bug reports without reproducible examples.
</sarcasm>

More seriously, for the hardworking R core people [I'm not one]
spending their time going through bug reports (and people on R-devel
list), please imagine yourself in their position and you realize
quickly that you can help them out with by giving a reproducible
example that they can cut'n'paste into their R session.  Also,
reporting the output of sessionInfo() is considered good etiquette.
In your case you might even be able to submit "before and after"
PNGs/PDFs illustrating the difference.

Cheers

Henrik
#
On May 20, 2008, at 8:05 PM, jms2003 at med.cornell.edu wrote:

            
Can you, please, specify exactly which graphics device you are using  
and possibly a snapshot of the problem? I don't see any additional  
boxes being drawn on any device.

The only issue I'm aware of are anti-aliasing effects around the edges  
of adjacent rectangles which don't fall on the pixel boundary (if anti- 
aliasing device is used). Depending on the subpixel location of the  
edge, the background color may shine through very slightly. It's not  
what you describe, but it's closest to what I can imagine you could  
mean. However, AFAICS this has not been changed recently and is a  
rendering artifact which is hard to get rid of in the current setup as  
devices are resolution-independent (the only cure I'm aware of [short  
of disabling anti-aliasing]  is to distort the original plot such that  
rectangles are aligned with the pixels of the output medium).

Cheers,
Simon
#
Sorry for lack of clarity but I didn't find away to upload images.

I am running Mac OS 10.5.2, R 2.7.0
The problem arrises when using anything that depends upon image()  
using the Quartz() device. This sounds very much like what you are  
describing with the background showing through (most obvious with tiny  
boxes in the example, n=100000). The problem does not occur when I use  
an x11 device. I did not have the problem using quartz as a screen  
device prior to upgrading to 2.7.0.  (Although I did have some odd  
behavior when I saved images from the quartz device as postscript or  
related file formats.)

Do you know of a workaround? I have tried setting quartz(antialias=F)  
but still have the problem.

tempF<-function(n) {
im<- matrix(0,nrow=n,ncol=5)
for (i in 1:5) {
    im[,i] <- seq(1,n)
}

image(im , col = topo.colors(100))
}

tempF(10)
tempF(1000)
tempF(100000)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Summary.001.png
Type: image/png
Size: 30555 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080521/b1408526/attachment.png>
-------------- next part --------------
On May 21, 2008, at 10:22 AM, Simon Urbanek wrote:

            
#
Simon Urbanek wrote:
I see lines at the borders of the grid used by image on my Mac (Tiger, R 
2.7.0 Patched (2008-05-20 r45743)).
They are most visible in the last of the examples plotted by 
example(image), the one that starts
image(x, y, volcano, col = terrain.colors(100), axes = FALSE).  It opens 
a Quartz device.

How do you do a snapshot on a Mac?  I see online that it's Cmd-Shift-4, 
and I get the snapshot click, but I don't know where the picture ended up.
I don't know if what I'm seeing is new or not; I've only got one R 
version installed.

Duncan Murdoch
#
(Edited to add link to sample picture)
Simon Urbanek wrote:
I see lines at the borders of the grid used by image on my Mac (Tiger, R
2.7.0 Patched (2008-05-20 r45743)).
They are most visible in the last of the examples plotted by
example(image), the one that starts
image(x, y, volcano, col = terrain.colors(100), axes = FALSE).  It opens
a Quartz device.

How do you do a snapshot on a Mac?  I see online that it's Cmd-Shift-4,
and I get the snapshot click, but I don't know where the picture ended up.

AHA!  It goes to the desktop.

Okay, a sample picture is available at

http://www.stats.uwo.ca/faculty/murdoch/temp/grid.png

Not as bad as Joseph was describing, but not nearly as good as Windows 
produces ;-).
I don't know if what I'm seeing is new or not; I've only got one R
version installed.

Duncan Murdoch
#
The effect Duncan's picture shows is typical of using anti-aliasing for 
rectangles and polygons.  The cairo-based devices have it turned off for 
filled regions, as it seems to have no advantage for R uses of such 
regions.  (You also see it with some on-screen renderers of postscript or 
pdf versions of this plot, e.g. those based on ghostscript.)

However, this does not match the original report, so I think we need a 
reproducible example (with screenshot) from Joseph Scandura to make any 
further progress.
On Wed, 21 May 2008, Duncan Murdoch wrote:

            

  
    
5 days later
#
Sorry for lack of clarity in my original message but I'm new to this  
list and I couldn't find away to upload images.

I am running Mac OS 10.5.2, R 2.7.0
The problem arrises when using anything that depends upon image()  
using the Quartz() device. This sounds very much like what you are  
describing with the background showing through (most obvious with tiny  
boxes in the example, n=100000). The problem does not occur when I use  
an x11 device. It sounds like this is an old problem without a good  
solution. What puzzles me is that I did not have the problem using  
quartz as a screen device prior to upgrading to 2.7.0.

Do you know of a workaround? I have tried setting quartz(antialias=F)  
but still have the problem.

tempF<-function(n) {
im<- matrix(0,nrow=n,ncol=5)
for (i in 1:5) {
   im[,i] <- seq(1,n)
}

image(im , col = topo.colors(100))
}

tempF(10)
tempF(1000)
tempF(100000)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Summary.001.png
Type: image/png
Size: 30555 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080527/c4acaebd/attachment.png>
-------------- next part --------------
On May 21, 2008, at 10:22 AM, Simon Urbanek wrote:

            
#
Joseph,

please try a more recent R, I have addressed the issue in R-devel/ 
R-2.7-patched after your report.

Cheers,
Simon
On May 27, 2008, at 6:07 PM, Joseph Scandura wrote: