Dear list,

A small follow up on this issue. The same behavior is observed for
postscript() and pdf(), so I suspect the erroneous code is in
grDevices/src/devPS.c. In particular, this macro,

static void
PostScriptSetLineTexture(FILE *fp, const char *dashlist, int nlty, double lwd)
{
/* use same macro for Postscript and PDF */
#define PP_SetLineTexture(_CMD_)                                                
\
    double dash;                                                                
\
    int i;                                                                      
\
    fprintf(fp,"[");                                                            
\
    for (i = 0; i < nlty; i++) {                                                
\
        dash = (lwd >= 1 ? lwd: 1) *                                            
\
            ((i % 2) ? dashlist[i] + 1                                          
\
             :((nlty == 1 && dashlist[i] == 1.) ? 1. : dashlist[i] - 1));       
\
        if (dash < 0) dash = 0;                                                 
\
        fprintf(fp," %.2f", dash);                                              
\
    }                                                                           
\
    fprintf(fp,"] 0 %s\n", _CMD_)

    PP_SetLineTexture("setdash");
}


I think the dash pattern should be

dash = (lwd >= 1 ? lwd: 1) *                                            \
            ((i % 2) ? dashlist[i]                                              
\
             :((nlty == 1 && dashlist[i] == 1.) ? 1. : dashlist[i] ));

instead (but I don't know C well enough to be sure).


Best regards,

baptiste

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to