10.08.2013 Views

Introduction to Stata 8

Introduction to Stata 8

Introduction to Stata 8

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Ticks, labels and gridlines<br />

<strong>Stata</strong> sets reasonable ticks and labels at the axes; you may also define them yourself. The<br />

following command sets a tick and a label for every 20 years at the x-axis, minor ticks divide<br />

each major interval in two. The y-axis has a log scale; tick marks are defined.<br />

twoway (line incidence year) , ///<br />

xlabel(1900(20)2000) xmtick(##2) ///<br />

yscale(log) ylabel(1 2 5 10 20 50 100)<br />

You may define maximum and minimum values at the axes:<br />

... , yscale(log range(0.8 150))<br />

If you use the s2color, s2mono or lean2 scheme, the default is horizontal gridlines and<br />

no vertical gridlines. To drop horizontal and include vertical gridlines (hardly a good idea in<br />

this case):<br />

... , xlabel( , grid) ylabel(1 2 5 10 20 50 100 , nogrid)<br />

If you want <strong>to</strong> display decimal commas rather than periods, give the <strong>Stata</strong> command:<br />

set dp comma<br />

Plotregion margin<br />

By default twoway graphs include a margin between the extreme plot values and the axes, <strong>to</strong><br />

avoid symbols <strong>to</strong>uching axes. If you want a zero margin – as in the twoway line plot,<br />

section 14.7 – include:<br />

... , plotregion(margin(zero))<br />

14.5. Placing graph elements<br />

The placement of graph elements, e.g. the legend, is defined by location relative <strong>to</strong> the plot<br />

area (ring position) and a direction (clock position). The placement of elements in Figure 1<br />

was determined by the scheme applied (see section 14.9); the placements were:<br />

Element Ring position<br />

ring()<br />

Clock position<br />

pos()<br />

Position can<br />

be modified<br />

Plot area 0 ... No<br />

Y-axis title 1 9 No<br />

X-axis title 1 6 No<br />

Subtitle 6 12 Yes<br />

Title 7 12 Yes<br />

Legend 3 4 Yes<br />

Note 4 7 Yes<br />

The twoway line plot, section 14.7, illustrates an alternative placement of the legend:<br />

... , legend(label(1 "Males") label(2 "Females") ring(0) pos(8))<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!