The R Project SVN R

Rev

Rev 6265 | Rev 7002 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6265 Rev 6994
Line 165... Line 165...
165
	for (i = 0; i < n; i++)
165
	for (i = 0; i < n; i++)
166
	    INTEGER(ans)[i] = CHAR(STRING(pch)[i])[0];
166
	    INTEGER(ans)[i] = CHAR(STRING(pch)[i])[0];
167
    }
167
    }
168
    else error("invalid plotting symbol");
168
    else error("invalid plotting symbol");
169
    for (i = 0; i < n; i++) {
169
    for (i = 0; i < n; i++) {
170
	if (INTEGER(ans)[i] < 0)
170
	if (INTEGER(ans)[i] < 0 && INTEGER(ans)[i] != NA_INTEGER)
171
	    INTEGER(ans)[i] = dflt;
171
	    INTEGER(ans)[i] = dflt;
172
    }
172
    }
173
    return ans;
173
    return ans;
174
}
174
}
175
 
175
 
Line 1020... Line 1020...
1020
/*	plot.xy(xy, type, pch, lty, col, cex, ...)
1020
/*	plot.xy(xy, type, pch, lty, col, cex, ...)
1021
 
1021
 
1022
 *	plot points or lines of various types
1022
 *	plot points or lines of various types
1023
 */
1023
 */
1024
    SEXP sxy, sx, sy, pch, cex, col, bg, lty;
1024
    SEXP sxy, sx, sy, pch, cex, col, bg, lty;
1025
    double *x, *y, xold, yold, xx, yy;
1025
    double *x, *y, xold, yold, xx, yy, thiscex;
1026
    int i, n, npch, ncex, ncol, nbg, nlty, type=0, start=0;
1026
    int i, n, npch, ncex, ncol, nbg, nlty, type=0, start=0, thispch, thiscol;
-
 
1027
    
1027
    SEXP originalArgs = args;
1028
    SEXP originalArgs = args;
1028
    DevDesc *dd = CurrentDevice();
1029
    DevDesc *dd = CurrentDevice();
1029
 
1030
 
1030
    /* Basic Checks */
1031
    /* Basic Checks */
1031
    GCheckState(dd);
1032
    GCheckState(dd);
Line 1064... Line 1065...
1064
    npch = length(pch);
1065
    npch = length(pch);
1065
 
1066
 
1066
    PROTECT(lty = FixupLty(CAR(args), dd->gp.lty));	args = CDR(args);
1067
    PROTECT(lty = FixupLty(CAR(args), dd->gp.lty));	args = CDR(args);
1067
    nlty = length(lty);
1068
    nlty = length(lty);
1068
 
1069
 
-
 
1070
    /* Default col was NA_INTEGER (0x80000000) which was interpreted
-
 
1071
       as zero (black) or "don't draw" depending on line/rect/circle
-
 
1072
       situation. Now we set the default to zero and don't plot at all
-
 
1073
       if col==NA.
-
 
1074
       
-
 
1075
       FIXME: bg needs similar change, but that requires changes to
-
 
1076
       the specific drivers. */
-
 
1077
 
1069
    PROTECT(col = FixupCol(CAR(args), NA_INTEGER));	args = CDR(args);
1078
    PROTECT(col = FixupCol(CAR(args), 0)); args = CDR(args); 
1070
    ncol = LENGTH(col);
1079
    ncol = LENGTH(col);
1071
 
1080
 
1072
    PROTECT(bg = FixupCol(CAR(args), NA_INTEGER));	args = CDR(args);
1081
    PROTECT(bg = FixupCol(CAR(args), NA_INTEGER));	args = CDR(args);
1073
    nbg = LENGTH(bg);
1082
    nbg = LENGTH(bg);
1074
 
1083
 
Line 1083... Line 1092...
1083
    y = REAL(sy);
1092
    y = REAL(sy);
1084
 
1093
 
1085
    if (nlty && INTEGER(lty)[0] != NA_INTEGER)
1094
    if (nlty && INTEGER(lty)[0] != NA_INTEGER)
1086
	dd->gp.lty = INTEGER(lty)[0];
1095
	dd->gp.lty = INTEGER(lty)[0];
1087
 
1096
 
1088
    if (ncex && R_FINITE(REAL(cex)[0]))
-
 
1089
	dd->gp.cex = dd->gp.cexbase * REAL(cex)[0];
-
 
1090
    else
-
 
1091
	dd->gp.cex = dd->gp.cexbase;
-
 
1092
 
-
 
1093
    GMode(1, dd);
1097
    GMode(1, dd);
1094
    /* removed by paul 26/5/99 because all clipping now happens in graphics.c
1098
    /* removed by paul 26/5/99 because all clipping now happens in graphics.c
1095
     * GClip(dd);
1099
     * GClip(dd);
1096
     */
1100
     */
1097
 
1101
 
Line 1208... Line 1212...
1208
	for (i = 0; i < n; i++) {
1212
	for (i = 0; i < n; i++) {
1209
	    xx = x[i];
1213
	    xx = x[i];
1210
	    yy = y[i];
1214
	    yy = y[i];
1211
	    GConvert(&xx, &yy, USER, DEVICE, dd);
1215
	    GConvert(&xx, &yy, USER, DEVICE, dd);
1212
	    if (R_FINITE(xx) && R_FINITE(yy)) {
1216
	    if (R_FINITE(xx) && R_FINITE(yy)) {
1213
		if (ncex > 1) 
1217
		if (R_FINITE(thiscex = REAL(cex)[i % ncex]) 
-
 
1218
		    && (thispch = INTEGER(pch)[i % npch]) != NA_INTEGER
-
 
1219
		    && (thiscol = INTEGER(col)[i % ncol]) != NA_INTEGER)
-
 
1220
		{
1214
		    dd->gp.cex = dd->gp.cexbase * REAL(cex)[i % ncex];
1221
		    dd->gp.cex = thiscex * dd->gp.cexbase;
1215
		dd->gp.col = INTEGER(col)[i % ncol];
1222
		    dd->gp.col = thiscol;
1216
		dd->gp.bg = INTEGER(bg)[i % nbg];
1223
		    dd->gp.bg = INTEGER(bg)[i % nbg];
1217
		GSymbol(xx, yy, DEVICE,
1224
		    GSymbol(xx, yy, DEVICE, thispch, dd);
1218
			INTEGER(pch)[i % npch], dd);
1225
		}
1219
	    }
1226
	    }
1220
	}
1227
	}
1221
    }
1228
    }
1222
    GMode(0, dd);
1229
    GMode(0, dd);
1223
    GRestorePars(dd);
1230
    GRestorePars(dd);