The R Project SVN R

Rev

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

Rev 27600 Rev 27757
Line 827... Line 827...
827
    /* axis(side, at, labels, tick, line, pos,
827
    /* axis(side, at, labels, tick, line, pos,
828
     *	    outer, font, vfont, lty, lwd, col, ...) */
828
     *	    outer, font, vfont, lty, lwd, col, ...) */
829
 
829
 
830
    SEXP at, lab, vfont;
830
    SEXP at, lab, vfont;
831
    int col, font, lty;
831
    int col, font, lty;
832
    int i, n, nint = 0, ntmp, side, *ind, outer;
832
    int i, n, nint = 0, ntmp, side, *ind, outer, lineoff = 0;
833
    int istart, iend, incr;
833
    int istart, iend, incr;
834
    Rboolean dolabels, doticks, logflag = FALSE;
834
    Rboolean dolabels, doticks, logflag = FALSE;
835
    Rboolean create_at, vectorFonts = FALSE;
835
    Rboolean create_at, vectorFonts = FALSE;
836
    double x, y, temp, tnew, tlast;
836
    double x, y, temp, tnew, tlast;
837
    double axp[3], usr[2];
837
    double axp[3], usr[2];
Line 897... Line 897...
897
 
897
 
898
    /* Specifies an offset outward from the plot for the axis.
898
    /* Specifies an offset outward from the plot for the axis.
899
     * The values in the par value "mgp" are interpreted
899
     * The values in the par value "mgp" are interpreted
900
     * relative to this value. */
900
     * relative to this value. */
901
    line = asReal(CAR(args));
901
    line = asReal(CAR(args));
-
 
902
    if (!R_FINITE(line)) {
-
 
903
	/* Except that here mgp values are not relative to themselves */
902
    if (!R_FINITE(line)) line =	 Rf_gpptr(dd)->mgp[2];
904
	line = Rf_gpptr(dd)->mgp[2];
-
 
905
	lineoff = line;
-
 
906
    }
903
    args = CDR(args);
907
    args = CDR(args);
904
 
908
 
905
    /* Optional argument: "pos" */
909
    /* Optional argument: "pos" */
906
    /* Specifies a user coordinate at which the axis should be drawn. */
910
    /* Specifies a user coordinate at which the axis should be drawn. */
907
    /* This overrides the value of "line".  Again the "mgp" par values */
911
    /* This overrides the value of "line".  Again the "mgp" par values */
908
    /* are interpreted relative to this value. */
912
    /* are interpreted relative to this value. */
909
 
913
 
910
    pos = asReal(CAR(args));
914
    pos = asReal(CAR(args));
911
    if (!R_FINITE(pos)) pos = NA_REAL;
915
    if (!R_FINITE(pos)) pos = NA_REAL; else lineoff = 0;
912
    args = CDR(args);
916
    args = CDR(args);
913
 
917
 
914
    /* Optional argument: "outer" */
918
    /* Optional argument: "outer" */
915
    /* Should the axis be drawn in the outer margin. */
919
    /* Should the axis be drawn in the outer margin. */
916
    /* This only affects the computation of axis_base. */
920
    /* This only affects the computation of axis_base. */
Line 1114... Line 1118...
1114
	    Rf_gpptr(dd)->adj = (side == 1) ? 1 : 0;
1118
	    Rf_gpptr(dd)->adj = (side == 1) ? 1 : 0;
1115
	}
1119
	}
1116
	else Rf_gpptr(dd)->adj = 0.5;
1120
	else Rf_gpptr(dd)->adj = 0.5;
1117
	if (side == 1) {
1121
	if (side == 1) {
1118
	    axis_lab = - axis_base
1122
	    axis_lab = - axis_base
1119
		+ GConvertYUnits(Rf_gpptr(dd)->mgp[1], LINES, NFC, dd)
1123
		+ GConvertYUnits(Rf_gpptr(dd)->mgp[1]-lineoff, LINES, NFC, dd)
1120
		+ GConvertY(0.0, NPC, NFC, dd);
1124
		+ GConvertY(0.0, NPC, NFC, dd);
1121
	}
1125
	}
1122
	else { /* side == 3 */
1126
	else { /* side == 3 */
1123
	    axis_lab = axis_base
1127
	    axis_lab = axis_base
1124
		+ GConvertYUnits(Rf_gpptr(dd)->mgp[1], LINES, NFC, dd)
1128
		+ GConvertYUnits(Rf_gpptr(dd)->mgp[1]-lineoff, LINES, NFC, dd)
1125
		- GConvertY(1.0, NPC, NFC, dd);
1129
		- GConvertY(1.0, NPC, NFC, dd);
1126
	}
1130
	}
1127
	axis_lab = GConvertYUnits(axis_lab, NFC, LINES, dd);
1131
	axis_lab = GConvertYUnits(axis_lab, NFC, LINES, dd);
1128
 
1132
 
1129
	/* The order of processing is important here. */
1133
	/* The order of processing is important here. */
Line 1239... Line 1243...
1239
	    Rf_gpptr(dd)->adj = (side == 2) ? 1 : 0;
1243
	    Rf_gpptr(dd)->adj = (side == 2) ? 1 : 0;
1240
	}
1244
	}
1241
	else Rf_gpptr(dd)->adj = 0.5;
1245
	else Rf_gpptr(dd)->adj = 0.5;
1242
	if (side == 2) {
1246
	if (side == 2) {
1243
	    axis_lab = - axis_base
1247
	    axis_lab = - axis_base
1244
		+ GConvertXUnits(Rf_gpptr(dd)->mgp[1], LINES, NFC, dd)
1248
		+ GConvertXUnits(Rf_gpptr(dd)->mgp[1]-lineoff, LINES, NFC, dd)
1245
		+ GConvertX(0.0, NPC, NFC, dd);
1249
		+ GConvertX(0.0, NPC, NFC, dd);
1246
	}
1250
	}
1247
	else { /* side == 4 */
1251
	else { /* side == 4 */
1248
	    axis_lab = axis_base
1252
	    axis_lab = axis_base
1249
		+ GConvertXUnits(Rf_gpptr(dd)->mgp[1], LINES, NFC, dd)
1253
		+ GConvertXUnits(Rf_gpptr(dd)->mgp[1]-lineoff, LINES, NFC, dd)
1250
		- GConvertX(1.0, NPC, NFC, dd);
1254
		- GConvertX(1.0, NPC, NFC, dd);
1251
	}
1255
	}
1252
	axis_lab = GConvertXUnits(axis_lab, NFC, LINES, dd);
1256
	axis_lab = GConvertXUnits(axis_lab, NFC, LINES, dd);
1253
 
1257
 
1254
	/* The order of processing is important here. */
1258
	/* The order of processing is important here. */