Skip to content
Shane Rosanbalm edited this page Apr 15, 2016 · 5 revisions

If you've ever used GPLOT, then you already know that the default continuous axis ranges that are produced are less than ideal, which is why several papers have been written proposing macros that will calculate axis ranges on the fly. The central theme of these macros is that we tell it about our data and it returns a recommendation, usually in the form of macro variables. We then plug these macro variables into our plot code.

axis1 order=(&start to &end by &by);

This approach is nice in that we only have to write the code once. Every time we rerun the code the macro will recalculate the range for us based on the current data. Think of it as self-maintaining code.

Then along comes SGPLOT and the default axis ranges are so much better. In particular the spacing of tick marks is just right and the by increments are always nice round numbers. In fact, they are almost good enough to make axis macros obsolete, but not quite. Just a few of the reasons you might still need an axis macro from time to time are:

  • Sometimes you know something that SGPLOT does not.
  • Sometimes you want consistent axes across multiple plots.
  • Sometimes you want a different number of tick marks than what SGPLOT is willing to give you.
  • And sometimes you just have to use GPLOT.

For these reasons and more, the existence of SGPLOT is not quite enough to do away with the need to have and use axis macros in certain situations.

Visit the Getting Started page to see a very basic application of the %axisorder macro.

Clone this wiki locally