38 PLFLT t1, t2, tick_reasonable;
47 pldtfac( vmin, vmax, &factor, NULL );
49 *tick = *tick / factor;
56 t1 = (
PLFLT) log10(
ABS( vmax - vmin ) );
57 np = (
PLINT) floor( t1 );
62 if ( t1 > 0.7781512503 )
67 else if ( t1 > 0.4771212549 )
72 else if ( t1 > 0.1760912591 )
87 tick_reasonable = t2 * pow( 10.0, (
double) np );
90 *tick = t2 * pow( 10.0, (
double) np );
95 if ( *tick < 1.e-4 * tick_reasonable )
97 plexit(
"pldtik: magnitude of specified tick spacing is much too small" );
104 *nsubt =
ABS( *nsubt );
108 *tick = *tick * factor;
132 plbtime( &year, &month, &day, &hour, &min, &sec, vmin );
135 if ( diff < 3.0 * 60.0 )
142 plctime( year, month, day, hour, min, sec, start );
145 else if ( diff < 3.0 * 60.0 * 60.0 )
153 plctime( year, month, day, hour, min, sec, start );
156 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 )
159 *factor = 60.0 * 60.0;
165 plctime( year, month, day, hour, min, sec, start );
168 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 * 7.0 )
171 *factor = 60.0 * 60.0 * 24.0;
177 plctime( year, month, day, hour, min, sec, start );
180 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 * 365 )
183 *factor = 60.0 * 60.0 * 24.0 * 7.0;
189 plctime( year, month, day, hour, min, sec, start );
195 *factor = 60.0 * 60.0 * 24.0 * 365.25;
203 plctime( year, month, day, hour, min, sec, start );
247 #define MIN_FLTDIG 3 // disregarded if fractional part is 0
254 PLFLT chosen, notchosen, vmod, t0;
255 PLINT msd, notmsd, np, digmin, digfix;
268 chosen = (
ABS( vmax ) >=
ABS( vmin ) ) ? vmax : vmin;
269 notchosen = (
ABS( vmax ) >=
ABS( vmin ) ) ? vmin : vmax;
272 if (
ABS( chosen ) > 0. )
274 vmod =
ABS( chosen );
275 t0 = (
PLFLT) log10( vmod );
276 msd = (
PLINT) floor( t0 );
282 t0 = (
PLFLT) log10( vmod );
283 msd = (
PLINT) floor( t0 );
286 if (
ABS( notchosen ) > 0. )
310 if ( chosen < 0. || ( notchosen < 0. && ( notmsd == msd || msd <= 0 ) ) )
313 if ( digmin > digfix && !lf )
322 np = (
PLINT) floor( log10(
ABS( tick ) ) );
327 *prec =
MAX( -np, 0 );
333 if ( *mode == 0 && digmax > 0 && !lf )
337 if ( digmax - 2 - *prec < 0 )
344 *prec =
MAX(
MIN( *prec, digmax - msd - 1 ), 0 );
void plexit(PLCHAR_VECTOR errormsg)
void pldtik(PLFLT vmin, PLFLT vmax, PLFLT *tick, PLINT *nsubt, PLBOOL ld)
void pldtfac(PLFLT vmin, PLFLT vmax, PLFLT *factor, PLFLT *start)
void pldprec(PLFLT vmin, PLFLT vmax, PLFLT tick, PLINT lf, PLINT *mode, PLINT *prec, PLINT digmax, PLINT *scale)