***************
*** 103,108 ****
       sizeof(Boolean), offset(axis.ticsOutside), XtRImmediate, (caddr_t)True},
    {XtNticsInside, XtCTicsInside, XtRBoolean,
       sizeof(Boolean), offset(axis.ticsInside), XtRImmediate, (caddr_t)False},
    {XtNticLength, XtCTicLength, XtRShort,
       sizeof(short), offset(axis.ticLength), XtRImmediate, (caddr_t)5},
    {XtNsubticLength, XtCTicLength, XtRShort,
--- 103,110 ----
       sizeof(Boolean), offset(axis.ticsOutside), XtRImmediate, (caddr_t)True},
    {XtNticsInside, XtCTicsInside, XtRBoolean,
       sizeof(Boolean), offset(axis.ticsInside), XtRImmediate, (caddr_t)False},
+   {XtNnumbersOutside, XtCNumbersOutside, XtRBoolean,
+      sizeof(Boolean), offset(axis.numbersOutside), XtRImmediate, (caddr_t)True},
    {XtNticLength, XtCTicLength, XtRShort,
       sizeof(short), offset(axis.ticLength), XtRImmediate, (caddr_t)5},
    {XtNsubticLength, XtCTicLength, XtRShort,
***************
*** 446,452 ****
    }
      
    if (Changed(min) || Changed(max) || Changed(transform) ||
!       Changed(ticDensity) ||Changed(subticDensity) || Changed(autoNumber) ||
        (!new->axis.autoNumber && (Changed(ticInterval)||Changed(subtics)))) {
      if (!new->axis.autoNumber) RecalcNumTics(new);
      compticspacing = True;
--- 448,455 ----
    }
      
    if (Changed(min) || Changed(max) || Changed(transform) ||
!       Changed(numbersOutside) || Changed(ticDensity) ||
!       Changed(subticDensity) || Changed(autoNumber) || 
        (!new->axis.autoNumber && (Changed(ticInterval)||Changed(subtics)))) {
      if (!new->axis.autoNumber) RecalcNumTics(new);
      compticspacing = True;
***************
*** 462,468 ****
  
    if (Changed(drawGrid)) redraw = True;
  
!   if (Changed(ticLabels) || (strcmp(new->axis.ticLabels, 
  				    new->axis.ticlabelcpy)))  {
      for (i = 0; i < new->axis.nuserticlabels; i++)
        XtFree(new->axis.userticlabels[i]);
--- 465,472 ----
  
    if (Changed(drawGrid)) redraw = True;
  
!   if (Changed(ticLabels) || (new->axis.ticLabels && 
! 			     strcmp(new->axis.ticLabels,
  				    new->axis.ticlabelcpy)))  {
      for (i = 0; i < new->axis.nuserticlabels; i++)
        XtFree(new->axis.userticlabels[i]);
***************
*** 580,586 ****
        if (a->vertical) {
  	x = a->x1;
  	y = a->ticcoords[i];
! 	if (a->mirror) 
  	  x += bt2 + 2;
  	else
  	  x -= bt1 + 2 + wid;
--- 584,590 ----
        if (a->vertical) {
  	x = a->x1;
  	y = a->ticcoords[i];
! 	if (!a->mirror ^ !!a->numbersOutside) 
  	  x += bt2 + 2;
  	else
  	  x -= bt1 + 2 + wid;
***************
*** 589,595 ****
        else {
  	x = a->ticcoords[i];
  	y = a->y1;
! 	if (a->mirror)
  	  y -= bt1 + 2 + a->numberFont->descent;
  	else
  	  y += bt2 + 2 + a->numberFont->ascent;
--- 593,599 ----
        else {
  	x = a->ticcoords[i];
  	y = a->y1;
! 	if (!a->mirror ^ !!a->numbersOutside)
  	  y -= bt1 + 2 + a->numberFont->descent;
  	else
  	  y += bt2 + 2 + a->numberFont->ascent;
***************
*** 700,705 ****
    else
      axis->ntics = 1+(int)((log10(axis->max) - log10(axis->min))
  			  * 10.0/w->axis.ticInterval);
    
    if (w->axis.ntics != oldntics) {
      axis->ticvalues = (double *)XtRealloc(axis->ticvalues,
--- 704,715 ----
    else
      axis->ntics = 1+(int)((log10(axis->max) - log10(axis->min))
  			  * 10.0/w->axis.ticInterval);
+ 
+   if (w->axis.ntics < 0 || w->axis.ntics > 10000) {
+     /* Obviously a major error - we hope an ensuing call to
+        AtAxisChangeNumbering will alter ticInterval! */
+     w->axis.ntics = oldntics;
+   }
    
    if (w->axis.ntics != oldntics) {
      axis->ticvalues = (double *)XtRealloc(axis->ticvalues,
***************
*** 929,935 ****
      if (axis->nuserticlabels)
        strcpy(buf, (i < axis->nuserticlabels ? axis->userticlabels[i] : ""));
      else
!       sprintf(buf, axis->ticFormat, axis->ticvalues[i]);
      len = strlen(buf);
      if (axis->ticlabels[i] != NULL) XtFree(axis->ticlabels[i]);
      axis->ticlabels[i] = strcpy(XtMalloc(len+1), buf);
--- 939,945 ----
      if (axis->nuserticlabels)
        strcpy(buf, (i < axis->nuserticlabels ? axis->userticlabels[i] : ""));
      else
!       sprintf(buf, axis->ticFormat, axis->ticvalues[i] * axis->ticMultiplier);
      len = strlen(buf);
      if (axis->ticlabels[i] != NULL) XtFree(axis->ticlabels[i]);
      axis->ticlabels[i] = strcpy(XtMalloc(len+1), buf);
***************
*** 942,961 ****
  /**********************************************************************/
  /*
   * returns the "width" (the height if horizontal) of the passed axis.
   */
  int AtAxisWidth(AtAxisObject w)
  {
    if (w->axis.vertical) {
      return ((w->axis.labelText) ? AtTextWidth(w->axis.labelText) : 0) +
!       ((w->axis.drawNumbers) ? w->axis.maxnumwidth : 0) +
! 	((w->axis.ticsOutside) ? TIC_LINE_LENGTH + 1 : 0) +
! 	  MIN_MARGIN;
    }
    else {
      return ((w->axis.labelText) ? AtTextHeight(w->axis.labelText) : 0) + 
!       ((w->axis.drawNumbers) ?
!        w->axis.numberFont->ascent+ w->axis.numberFont->descent :0) +
! 	 ((w->axis.ticsOutside) ? TIC_LINE_LENGTH + 1 : 0) +
  	   MIN_MARGIN;
    }
  }
--- 952,973 ----
  /**********************************************************************/
  /*
   * returns the "width" (the height if horizontal) of the passed axis.
+  * Only considers that part of the label marked "outside".
   */
  int AtAxisWidth(AtAxisObject w)
  {
    if (w->axis.vertical) {
      return ((w->axis.labelText) ? AtTextWidth(w->axis.labelText) : 0) +
!       ((w->axis.drawNumbers && w->axis.numbersOutside) ?
!        w->axis.maxnumwidth : 0) +
! 	 ((w->axis.ticsOutside) ? w->axis.ticLength + 1 : 0) +
! 	   MIN_MARGIN;
    }
    else {
      return ((w->axis.labelText) ? AtTextHeight(w->axis.labelText) : 0) + 
!       ((w->axis.drawNumbers && w->axis.numbersOutside) ?
!        w->axis.numberFont->ascent+ w->axis.numberFont->descent : 0) +
! 	 ((w->axis.ticsOutside) ? w->axis.ticLength + 1 : 0) +
  	   MIN_MARGIN;
    }
  }
***************
*** 1065,1067 ****
    else
      XtWarning(errortext);
  }
--- 1077,1084 ----
    else
      XtWarning(errortext);
  }
+ /*
+  * Local Variables:
+  * eval: (set-c-style 'GNU)
+  * End:
+  */
