[Rd] rendering dashed steps produces solid horizontal lines (PR#9953)

chris.bainbridge at gmail.com chris.bainbridge at gmail.com
Wed Oct 10 16:35:25 CEST 2007


Full_Name: Chris Bainbridge
Version: 2.2.1
OS: Linux
Submission from: (NULL) (86.157.4.96)


The following python script will render two pdf files, one with lines and one
with steps. The pdf with steps (s.pdf) renders the horizontal line as a solid
when it should be dotted as in lpdf. It seems as though R tries to render every
data point individually when using steps, but manages to join them all together
as a straight line when using lines.

#!/usr/bin/python                                                               
                  
import os                                                                       
                  
                                                                                
                  
f=open('x.txt','w')                                                             
                  
i=0                                                                             
                  
f.write('x y\n')                                                                
                  
while i<100:                                                                    
                  
    f.write('%f %f\n'%(i,0.5))                                                  
                  
    i+=1                                                                        
                  
f.close()                                                                       
                  
rscr="""pdf('%s.pdf')                                                           
                  
d <- read.table('x.txt', header=T)                                              
                  
attach(d)                                                                       
                  
plot(x,y, bty='n', las=1, lty=2,type='%s')                                      
                  
"""                                                                             
                  
f=open('l.r','w')                                                               
                  
f.write(rscr%('l','l'))                                                         
                  
f.close()                                                                       
                  
os.system('R -q --no-save < l.r')                                               
                  
f=open('s.r','w')                                                               
                  
f.write(rscr%('s','s'))                                                         
                  
f.close()                                                                       
                  
os.system('R -q --no-save < s.r')



More information about the R-devel mailing list