The R Project SVN R

Rev

Rev 9642 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9642 Rev 10108
Line 894... Line 894...
894
    outer = asLogical(CAR(args));
894
    outer = asLogical(CAR(args));
895
    if (outer == NA_LOGICAL || outer == 0)
895
    if (outer == NA_LOGICAL || outer == 0)
896
	outer = NPC;
896
	outer = NPC;
897
    else
897
    else
898
	outer = NIC;
898
	outer = NIC;
899
    
899
 
900
    args = CDR(args);
900
    args = CDR(args);
901
 
901
 
902
    /* Retrieve relevant "par" values. */
902
    /* Retrieve relevant "par" values. */
903
 
903
 
904
    switch(side) {
904
    switch(side) {
Line 972... Line 972...
972
    ProcessInlinePars(args, dd);
972
    ProcessInlinePars(args, dd);
973
 
973
 
974
    /* At this point we know the value of "xaxt" and "yaxt" */
974
    /* At this point we know the value of "xaxt" and "yaxt" */
975
    /* so we test to see whether the relevant one is "n". */
975
    /* so we test to see whether the relevant one is "n". */
976
    /* If it is, we just bail out at this point. */
976
    /* If it is, we just bail out at this point. */
977
    
977
 
978
    if (((side == 1 || side == 3) && dd->gp.xaxt == 'n') ||
978
    if (((side == 1 || side == 3) && dd->gp.xaxt == 'n') ||
979
	((side == 2 || side == 4) && dd->gp.yaxt == 'n')) {
979
	((side == 2 || side == 4) && dd->gp.yaxt == 'n')) {
980
	GRestorePars(dd);
980
	GRestorePars(dd);
981
	UNPROTECT(3);
981
	UNPROTECT(3);
982
	return R_NilValue;
982
	return R_NilValue;
Line 1223... Line 1223...
1223
    n = LENGTH(sx);
1223
    n = LENGTH(sx);
1224
    args = CDR(args);
1224
    args = CDR(args);
1225
 
1225
 
1226
    if (isNull(CAR(args))) type = 'p';
1226
    if (isNull(CAR(args))) type = 'p';
1227
    else {
1227
    else {
1228
	if (isString(CAR(args)) && LENGTH(CAR(args)) == 1)
1228
	if (isString(CAR(args)) && LENGTH(CAR(args)) == 1 &&
1229
	    type = CHAR(STRING_ELT(CAR(args), 0))[0];
1229
	    LENGTH(pch = STRING_ELT(CAR(args), 0)) >= 1) {
-
 
1230
	    if(LENGTH(pch) > 1)
-
 
1231
		warningcall(call, "plot type '%s' truncated to first character",
-
 
1232
			    CHAR(pch));
-
 
1233
	    type = CHAR(pch)[0];
-
 
1234
	}
1230
	else errorcall(call, "invalid plot type");
1235
	else errorcall(call, "invalid plot type");
1231
    }
1236
    }
1232
    args = CDR(args);
1237
    args = CDR(args);
1233
 
1238
 
1234
    PROTECT(pch = FixupPch(CAR(args), dd->gp.pch));	args = CDR(args);
1239
    PROTECT(pch = FixupPch(CAR(args), dd->gp.pch));	args = CDR(args);
Line 1268... Line 1273...
1268
    GMode(1, dd);
1273
    GMode(1, dd);
1269
    /* removed by paul 26/5/99 because all clipping now happens in graphics.c
1274
    /* removed by paul 26/5/99 because all clipping now happens in graphics.c
1270
     * GClip(dd);
1275
     * GClip(dd);
1271
     */
1276
     */
1272
 
1277
 
1273
    if (type == 'l' || type == 'o') {
1278
    switch(type) {
-
 
1279
    case 'l':
-
 
1280
    case 'o':
1274
	/* lines and overplotted lines and points */
1281
	/* lines and overplotted lines and points */
1275
	dd->gp.col = INTEGER(col)[0];
1282
	dd->gp.col = INTEGER(col)[0];
1276
	xold = NA_REAL;
1283
	xold = NA_REAL;
1277
	yold = NA_REAL;
1284
	yold = NA_REAL;
1278
	for (i = 0; i < n; i++) {
1285
	for (i = 0; i < n; i++) {
Line 1293... Line 1300...
1293
		     (i == n-1))
1300
		     (i == n-1))
1294
		GPolyline(n-start, x+start, y+start, USER, dd);
1301
		GPolyline(n-start, x+start, y+start, USER, dd);
1295
	    xold = xx;
1302
	    xold = xx;
1296
	    yold = yy;
1303
	    yold = yy;
1297
	}
1304
	}
1298
    }
1305
	break;
-
 
1306
 
1299
    else if (type == 'b' || type == 'c') {
1307
    case 'b':
1300
	/* points connected with broken lines */
1308
    case 'c': /* broken lines (with points in between if 'b') */
-
 
1309
    {
1301
	double d, f;
1310
	double d, f;
1302
	d = GConvertYUnits(0.5, CHARS, INCHES, dd);
1311
	d = GConvertYUnits(0.5, CHARS, INCHES, dd);
1303
	dd->gp.col = INTEGER(col)[0];
1312
	dd->gp.col = INTEGER(col)[0];
1304
	xold = NA_REAL;
1313
	xold = NA_REAL;
1305
	yold = NA_REAL;
1314
	yold = NA_REAL;
Line 1319... Line 1328...
1319
	    }
1328
	    }
1320
	    xold = xx;
1329
	    xold = xx;
1321
	    yold = yy;
1330
	    yold = yy;
1322
	}
1331
	}
1323
    }
1332
    }
-
 
1333
    break;
-
 
1334
 
1324
    else if (type == 's') { /* step function  I */
1335
    case 's': /* step function  I */
-
 
1336
    {
1325
	double xtemp[3], ytemp[3];
1337
	double xtemp[3], ytemp[3];
1326
	dd->gp.col = INTEGER(col)[0];
1338
	dd->gp.col = INTEGER(col)[0];
1327
	xold = x[0];
1339
	xold = x[0];
1328
	yold = y[0];
1340
	yold = y[0];
1329
	GConvert(&xold, &yold, USER, DEVICE, dd);
1341
	GConvert(&xold, &yold, USER, DEVICE, dd);
Line 1340... Line 1352...
1340
	    }
1352
	    }
1341
	    xold = xx;
1353
	    xold = xx;
1342
	    yold = yy;
1354
	    yold = yy;
1343
	}
1355
	}
1344
    }
1356
    }
-
 
1357
    break;
-
 
1358
 
1345
    else if (type == 'S') { /* step function  II */
1359
    case 'S': /* step function  II */
-
 
1360
    {
1346
	double xtemp[3], ytemp[3];
1361
	double xtemp[3], ytemp[3];
1347
	dd->gp.col = INTEGER(col)[0];
1362
	dd->gp.col = INTEGER(col)[0];
1348
	xold = x[0];
1363
	xold = x[0];
1349
	yold = y[0];
1364
	yold = y[0];
1350
	GConvert(&xold, &yold, USER, DEVICE, dd);
1365
	GConvert(&xold, &yold, USER, DEVICE, dd);
Line 1361... Line 1376...
1361
	    }
1376
	    }
1362
	    xold = xx;
1377
	    xold = xx;
1363
	    yold = yy;
1378
	    yold = yy;
1364
	}
1379
	}
1365
    }
1380
    }
-
 
1381
    break;
-
 
1382
 
1366
    else if (type == 'h') { /* h[istogram] (bar plot) */
1383
    case 'h': /* h[istogram] (bar plot) */
1367
	dd->gp.col = INTEGER(col)[0];
1384
	dd->gp.col = INTEGER(col)[0];
1368
	if (dd->gp.ylog)
1385
	if (dd->gp.ylog)
1369
	    yold = dd->gp.usr[2];/* DBL_MIN fails.. why ???? */
1386
	    yold = dd->gp.usr[2];/* DBL_MIN fails.. why ???? */
1370
	else
1387
	else
1371
	    yold = 0.0;
1388
	    yold = 0.0;
Line 1376... Line 1393...
1376
	    GConvert(&xx, &yy, USER, DEVICE, dd);
1393
	    GConvert(&xx, &yy, USER, DEVICE, dd);
1377
	    if (R_FINITE(xx) && R_FINITE(yy)) {
1394
	    if (R_FINITE(xx) && R_FINITE(yy)) {
1378
		GLine(xx, yold, xx, yy, DEVICE, dd);
1395
		GLine(xx, yold, xx, yy, DEVICE, dd);
1379
	    }
1396
	    }
1380
	}
1397
	}
-
 
1398
	break;
-
 
1399
 
1381
    }
1400
    case 'p':
-
 
1401
    case 'n': /* nothing here */
-
 
1402
	break;
-
 
1403
 
-
 
1404
    default:/* OTHERWISE */
-
 
1405
	errorcall(call, "invalid plot type '%c'", type);
-
 
1406
 
-
 
1407
    } /* switch(type) */
-
 
1408
 
1382
    if (type == 'p' || type == 'b' || type == 'o') {
1409
    if (type == 'p' || type == 'b' || type == 'o') {
1383
	for (i = 0; i < n; i++) {
1410
	for (i = 0; i < n; i++) {
1384
	    xx = x[i];
1411
	    xx = x[i];
1385
	    yy = y[i];
1412
	    yy = y[i];
1386
	    GConvert(&xx, &yy, USER, DEVICE, dd);
1413
	    GConvert(&xx, &yy, USER, DEVICE, dd);
Line 2207... Line 2234...
2207
    line = asReal(CAR(args));
2234
    line = asReal(CAR(args));
2208
    args = CDR(args);
2235
    args = CDR(args);
2209
 
2236
 
2210
    outer = asLogical(CAR(args));
2237
    outer = asLogical(CAR(args));
2211
    if (outer == NA_LOGICAL) outer = 0;
2238
    if (outer == NA_LOGICAL) outer = 0;
2212
    args = CDR(args);    
2239
    args = CDR(args);
2213
 
2240
 
2214
    GSavePars(dd);
2241
    GSavePars(dd);
2215
    RecordGraphicsCall(call);
2242
    RecordGraphicsCall(call);
2216
    ProcessInlinePars(args, dd);
2243
    ProcessInlinePars(args, dd);
2217
 
2244
 
Line 2317... Line 2344...
2317
	else {
2344
	else {
2318
	    hpos = GConvertX(adj, NPC, USER, dd);
2345
	    hpos = GConvertX(adj, NPC, USER, dd);
2319
	    where = 0;
2346
	    where = 0;
2320
	}
2347
	}
2321
	if (isExpression(xlab))
2348
	if (isExpression(xlab))
2322
	    GMMathText(VECTOR_ELT(xlab, 0), 1, vpos + i, where,
2349
	    GMMathText(VECTOR_ELT(xlab, 0), 1, vpos, where,
2323
		       hpos, 0, dd);
2350
		       hpos, 0, dd);
2324
	else {
2351
	else {
2325
	    n = length(xlab);
2352
	    n = length(xlab);
2326
	    for (i = 0; i < n; i++)
2353
	    for (i = 0; i < n; i++)
2327
		GMtext(CHAR(STRING_ELT(xlab, i)), 1, vpos + i, where,
2354
		GMtext(CHAR(STRING_ELT(xlab, i)), 1, vpos + i, where,
Line 3266... Line 3293...
3266
    int ask;
3293
    int ask;
3267
 
3294
 
3268
    checkArity(op, args);
3295
    checkArity(op, args);
3269
    if(!isList(theList = CAR(args)))
3296
    if(!isList(theList = CAR(args)))
3270
       errorcall(call, "invalid argument");
3297
       errorcall(call, "invalid argument");
-
 
3298
    dd->displayList = theList;
3271
    if (theList != R_NilValue) {
3299
    if (theList != R_NilValue) {
3272
	ask = dd->gp.ask;
3300
	ask = dd->gp.ask;
3273
	dd->gp.ask = 1;
3301
	dd->gp.ask = 1;
3274
	GReset(dd);
3302
	GReset(dd);
3275
	while (theList != R_NilValue) {
3303
	while (theList != R_NilValue) {