[Rd] Line rendering in windows - bug?

Steve Roberts steve.roberts@man.ac.uk
Fri Feb 14 09:18:03 2003


Dear all, 

One for the windows graphics developers I guess.... 

I seem to have hit a bug in the line drawing in  windows (default 
device or explicit calls to win.metafile). As the line segments used 
to plot a curve get smaller (increased resolution)  the line drawn 
seems to get less smooth rather than more smooth, and starts to 
break up.. Attached is a toy example drawing a quadratic with 
increasing resolution. In my real example - a plot for publication - it 
is very difficult to find a compromise where the line segments are 
close enough to give a smooth-looking curve without the thing 
breaking down. Look like a bug or feature in plotting small line 
segments? Using pdf() seems to be OK which suggests a windows 
driver issue - I dimly recall something about wmf and maybe emf 
having an implicit resolution, despite being a vector format. I have 
also noticed that filled symbols (eg pch=16) are not always 
completely filled, but haven't an example to demonstrate this. 

Keep up the good work! 

Steve. 

------------------------example----------------------------------
 #axes and text rendered well 
plot(c(0,22),c(0,100),xlab="X-axis",ylab="Y-axis",type="n")
#lines with large segments 
x<-0:10 
y<-x^2 
for (delta in 1:4) lines(x+delta,y,lwd=delta,type="l") 
#more detailed lines 
x<-seq(0,10,by=.1) 
y<-x^2 
for (delta in 1:4) lines(x+4+delta,y,lwd=delta,type="l") 
#even more detailed lines 
x<-seq(0,10,by=.01) 
y<-x^2 
for (delta in 1:4) lines(x+8+delta,y,lwd=delta,type="l") 
-------------------------------------------------------------------------------------------- 
  Dr Steve Roberts 
  steve.roberts@man.ac.uk

Senior Lecturer in Medical Statistics,
CMMCH NHS Trust and University of Manchester Biostatistics Group,
0161 275 5192 / 0161 276 5785