*! version 1.0.0 11June2016

help optaspect

Title

optaspect -- Heuristic criteria for optimal aspect ratios in a two-variable line plot

Syntax

optaspect yvar xvar [if] [in] [weight]
[, sort cullzero stackby(varname) y0 gor lor wlc iterate(#) tolerance(#)]

Description

The command optaspect calculates the optimal aspect ratio for a
two-variable line graph using a number of heuristic criteria that are
based on the principle of maximizing the contrast between the many line segments.
Line plots encode a series of slopes from adjoining
coordinates with the purpose of revealing suggestive patterns in the sequential
rates of change. The judged prevalence of patterns in the bivariate series
and the degree of steepness in the rates of change is largely determined by
the choice of aspect ratio that is imposed on the line plot. Choosing an
appropriate aspect ratio is key in designing informative line plots.

Options

Method options

sort orders the dataset on xvar in ascending order.
sort is required for unordered data

rank replaces xvar with a variable t that takes
the values t=1,2,...,n

cullzero ignores zero slopes in the calculation of
the optimal aspect ratios

stackby(varname) specifies the calculation of average
optimal aspect ratios over all categories of varname, on the basis
that the line graph will be split-and-stacked by these categories

y0 specifies that the y-axis of the line graph will
contain the baseline value of zero and that the aspect ratio should
be adjusted accordingly.

gor calculates the computationally expensive
Global Orientation Resolution criterion (GOR)

lor calculates the Local Orientation Resolution criterion (LOR)

lor calculates the Weighted Local Curvature criterion (LOR)

Iteration options

iterate(#) specify the number of iterations for those criteria
that require iterative optimization (AAO, WAAO, LOR, GOR, ARC). The default
is iterate(100). This option is rarely used

tolerance(#) specify the convergence tolerance for those criteria
that require iterative optimization (AAO, WAAO, LOR, GOR, ARC). The default
is tolerance(1e-6). This option is rarely used

Examples

Sunspot activity

. webuse sunspot.dta

. optaspect spot time

. optaspect spot time if inrange(time,1749,1924), lor gor cullzero

Airline Passengers

. webuse air2

. optaspect air time

. optaspect air time, cullzero rank

Gross national product

. sysuse gnp96

. optaspect gnp96 date

Price of cars versus mileage

. sysuse auto

. generate ln_p = ln(price)

. generate ln_m = ln(mpg)

. lowess ln_p ln_m, generate(ln_p_sm)

. optaspect ln_p_sm ln_m, sort

S&P 500 daily return

. sysuse sp500

. generate ret = change[_n]/close[_n-1]

. quietly summarize ret

. generate abn_ret = ret - r(mean)

. generate quarter = quarter(date)

. optaspect abn_ret t, rank stackby(quarter)

Life expectancy

. webuse uslifeexp

. optaspect le year, sort cull wlc lor gor

. generate diff = le_wm - le_bm

. lowess diff year, generate(diff_sm)

. optaspect diff_sm year, y0

Saved results

Scalars
r(mas) MAS aspect ratio
r(aas) AAS aspect ratio
r(waao) WAAO aspect ratio
r(aao) AAO aspect ratio
r(gor) GOR aspect ratio
r(lor) LOR aspect ratio
r(arc) ARC aspect ratio
r(rv) RV aspect ratio
r(wlc) WLC aspect ratio
r(n) Number of slopes in the data
r(cull) Number of zero slopes culled

Key references

Christodoulou, D. (20XX),
optaspect: Heuristic criteria for selecting an optimal aspect ratio in a two-variable line plot,
The Stata Journal, Volume vv, Number ii, pp. xx-xx.

Cleveland, W. S., M. E. McGill, and R. McGill (1988),
The shape parameter of a two-variable graph,
Journal of the American Statistical Association, Volume 83, Number 402, pp. 289-300.

Cleveland, W. S. (1993),
A Model for Studying Display Methods of Statistical Graphics,
Journal of Computational and Graphical Statistics, Volume 2, Number 4, pp. 323-343.

Guha S. and W. S. Cleveland (2011),
Perceptual, mathematical, and statistical properties of judging functional dependence on visual displays,
Technical report, Purdue University Department of Statistics.

Han, F., Y. Wang, J. Zhang, O. Deussen, and B. Chen (2016),
Mathematical Foundations of Arc Length-Based Aspect Ratio Selection,
IEEE Pacific Visualization Symposium (PacificVis), pp. 9-15.

Heer, J., and M. Agrawala (2006),
Multi-scale banking to 45,
IEEE Transcations on Visualisation and Computer Graphics, Volume 12, Number 5, pp. 701-708.

Talbot, J., J. Gerth, and P. Hanrahan (2011),
Arc length-based aspect ratio selection,
InfoVis Conference Proceedings.

Talbot, J., J. Gerth, and P. Hanrahan (2012),
A Model for Studying Display Methods of Statistical Graphics,
InfoVis Conference Proceedings.

Author

Demetris Christodoulou

MEAFA Research Group

The University of Sydney Business School

Sydney, NSW 2006

Australia

demetris.christodoulou@sydney.edu.au