Graphics Reference
In-Depth Information
The reason for this is that the marker has a line color and a fill color, and by default,
they are the same color, so it is impossible to see the effect of changing the thickness of the
line around the marker. However, if we make the line and fill colors different, as in the
following example, we can see the effect of the mlwidth() option:
. twoway scatter propval100 rent700, mlwidth(thick)
mlcolor(black) mfcolor(gs13)
Options when using by()
Using the by() option changes the meaning of some options. Consider the following
example:
. twoway scatter propval100 rent700, by(north) title(My title)
We might think that the title() option will provide an overall title for the graph, as it
would when the by() option is not included. However, actually, each graph will have “My
title” as the title; the graph as a whole will not. Instead, to provide an overall title for the
graph, we would specify the command this way:
. twoway scatter propval100 rent700, by(north, title(My title))
When using the legend() option combined with the by() option, we should place
options that affect the position of the legend within the by() option. Consider this example:
. twoway scatter propval100 popden rent700,
by(north, legend(pos(12))) legend(cols(1))
Here, the legend(pos(12)) option controls the position of the legend, placing it at
the 12 o'clock position, so we place it within the by() option. On the other hand, the
legend(cols(1)) option does not affect the position of the legend, so we place it outside
of the by() option. For more details on this, see Options : By (272).
Altering the wrong axis
When we use multiple
x
-or
y
-axes, it is easy to modify the wrong axis. Consider this
example:
. twoway (scatter propval100 ownhome)
(scatter rent700 ownhome, yaxis(2) ytitle(Rents over 700) )
We might think that the ytitle() option will change the title for the second
-axis,
but it will actually change the first axis. Because ytitle() is an option that concerns the
overall graph, we should place it at the very end of the graph command, as shown below.
y
. twoway (scatter propval100 ownhome)
(scatter rent700 ownhome, yaxis(2)), ytitle(Rents over 700, axis(2))
Note that we use the axis(2) option to indicate that ytitle() should be modified for the
second
y
-axis.
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.
Search WWH ::




Custom Search