LOG Axes

Overview of LOG Axes

An axis displaying a logarithmic scale is very useful when your data values span orders of magnitude. For example, when you plot your growth data with a linear axis, you suspect that the growth rate is exponential.
layout overlay;
  seriesplot x=Hours y=Growth;
endlayout;
Linear Y-Axis
To confirm this, you can request a log axis, which is never drawn by default. Instead, you must request it with the TYPE=LOG axis option. Any of the four axes can be a log axis.
layout overlay / yaxisopts=(type=log);
Default Log Axis, Base 10
The numeric data that is used for a log axis must be positive. If zero or negative values are encountered, a linear axis is substituted and the following note is written to the log:
NOTE: Log axis cannot support zero or negative values in the data range. The axis type will
      be changed to LINEAR.

Setting the Log Base

You can show a log axis with any of three bases: 10, 2 and E (natural log). The default log base is 10. To set another base, use the BASE= suboption setting of the LOGOPTS= option.
layout overlay / yaxisopts=(type=log logopts=(base=2) );
Log Axis, Base 2
layout overlay / yaxisopts=(type=log logopts=(base=e) );
Log Axis, Base E

Setting the Tick Intervals

Log axes support the TICKINTERVALSTYLE= option, which provides different styles for displaying tick values:
AUTO
A LOGEXPAND, LOGEXPONENT, or LINEAR representation is chosen automatically, based on the range of the data. When the data range is small (within an order of magnitude), a LINEAR representation is typically used. Data ranges that encompass several orders of magnitude typically use the LOGEXPAND or LOGEXPONENT representation. AUTO is the default.
LOGEXPAND
Major ticks are placed at uniform intervals at integer powers of the base. By default, a BEST6. format is applied to BASE=10 and BASE=2 tick values. This means that, depending on the range of data values, you might see very large or very small values written in exponential notation (10E6 instead of 1000000). The preceding examples with a log axis show TICKINTERVALSYTLE=LOGEXPAND.
LOGEXPONENT
Major ticks are placed at uniform intervals at integer powers of the base. The tick values are only the integer exponents for all bases.
LINEAR
Major tick marks are placed at non-uniform intervals, covering the range of the data.
When using TICKINTERVALSTYLE=LOGEXPONENT, it might not be clear what base is being used. You should consider adding information to the axis label to clarify the situation:
layout overlay / yaxisopts=(type=log label="Growth (Powers of 10)"
  logopts=(base=10 tickintervalstyle=logexponent));
Log Axis, Base 10, TICKINTERVALSTYLE=LOGEXPONENT
When using TICKINTERVALSTYLE=LINEAR, it is visually helpful to turn on the grid lines:
layout overlay / yaxisopts=(type=log  griddisplay=on
  logopts=(base=10 tickintervalstyle=linear));
Log Axis, Base 10, TICKINTERVALSTYLE=LINEAR
When using BASE=10 and TICKINTERVALSTYLE=LOGEXPAND or TICKINTERVALSTYLE=LOGEXPONENT, you can add minor ticks to emphasize the log scale:
layout overlay / yaxisopts=(type=log griddisplay=on
  logopts=(base=10 tickintervalstyle=linear minorticks=true ));
Log Axis, Base 10, TICKINTERVALSTYLE=LINEAR
As with LINEAR and TIME axes, the data range of a log axis can be set with the VIEWMIN= and VIEWMAX= log options.
If your input data has already been transformed into log values, you should always use a LINEAR axis to display them, not a LOG axis.
layout overlay;
  seriesplot x=Hours y=eval(log10(growth));
endlayout;
Log Axis Displaying Existing Log Data