* Coordinates - range and linear/log sysuse auto, clear * The default coordinates are a linear scale, with a default range * wide enough to show all the data. This does not necessarily * include the origin, (0,0). scatter price mpg * We can extend an axis range, but not truncate it. * Notice that the scale is extended, but not the labeling! scatter price mpg, yscale(range(10000 20000)) * Specifying a label is often a convenient way to * extend a range. scatter price mpg, ylabel(0(5000)20000) * To truncate a scale, you must specify a subset of * the data (i.e. change the graph-data set) scatter price mpg if price>10000 & price<20000 * Likewise with categorical graphs, but the 0 is * included by default on the continuous (y) scale graph dot price, over(rep78) graph dot price, over(rep78) yscale(range(3000 8000)) * However, there is an option to exclude it, and we use * ylabel as a convenient way to both relabel and rescale graph dot price, over(rep78) ylabel(3000(1000)8000) exclude0 * To pick/truncate categorical values, we again take a subset * of the data. (And if we wanted a gap in the categorical * scale, we would switch to "twoway dot".) graph dot price if rep78~=3, over(rep78) * Turning back to twoway plots, notice that coordinates are * merged when we layer plots scatter price mpg line weight mpg, sort twoway (scatter price mpg) (line weight mpg, sort) * This means there are three places to specify axis options twoway (scatter price mpg, ylabel(0(3000)15000)) /// (line weight mpg, sort yscale(range(0 18000))), ytick(0(1000)10000) * If you specify the same option in multiple places, the options * are merged - exactly how depends on the option, so look * it up! * We can also define up to 9 parallel axes