Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: marginsplot
From
Tirthankar Chakravarty <[email protected]>
To
[email protected]
Subject
Re: st: marginsplot
Date
Wed, 3 Oct 2012 16:28:55 +0530
You have a few options:
1) You can change the Stata graph scheme to something like "s2mono" so
that graphs are appropriate for B&W printing. For example:
*------------------------------------------------
use http://fmwww.bc.edu/ec-p/data/wooldridge/wagepan, clear
xtset nr year
xtreg lwage exper educ union hisp black ///
i.married##i.year, fe
set scheme s2mono
margins, over(married year)
marginsplot, xdimension(year) ///
plotdimension(married) xlabel(, angle(90))
*------------------------------------------------
2) Or you can manually change the marker symbols of each of the -by-
dimensions of your plot using standard -twoway- plot options. This is
tedious but allows you greatest control (continuing the previous
example):
*------------------------------------------------
xtreg lwage exper educ union hisp black ///
i.married##i.year, fe
set scheme s2color
margins, over(married year)
marginsplot, xdimension(year) ///
plotdimension(married) ///
plot1opts(msymbol(D)) /// marker for first line
plot2opts(msymbol(Oh)) // marker for second line
*------------------------------------------------
See [G-4] symbolstyle for a full list of available marker styles.
3) You can automate this process using the -levelsof- the -by-
variable and iteratively constructing the plot options, as in this
example:
*------------------------------------------------
sysuse auto, clear
reg mpg i.foreign##c.(rep78 headroom trunk weight)
qui levelsof foreign, local(levels) // -levelsof- -by- variable
local markerlist "O d p o" // a list of marker styles
local optioncount 1 // begin with first plot line
foreach level of local levels {
if("`markerlist'" ~="") local markeroption: ///
word 1 of `markerlist'
else {
di "Out of marker styles!"
}
local markerlist: list markerlist - markeroption
local plotoptions ///
"`plotoptions' plot`optioncount'opts(msymbol(`markeroption'))"
local ++optioncount
}
di "`plotoptions'" // check plot options are correctly formed
margins, dydx(*) over(foreign)
marginsplot, xdim(_deriv) `plotoptions'
*------------------------------------------------
T
On Wed, Oct 3, 2012 at 2:12 PM, Melvyn Weeks <[email protected]> wrote:
> I am using marginsplot, and displaying multiple plots on one graph.
>
> How do I control whether points are displayed as circles, triangles,
> squares ...
>
> The default seem to be that all points are circles which is not so good
> on a black and white printer
>
> Thanks
> Melvyn
>
> --
> Dr. M. Weeks
> Senior Lecturer in Economics
> University of Cambridge
>
> Fellow of Clare College
>
> t. (+44) 01223 335260
> f. (+44) 01223 335959
>
> e. [email protected]
>
> w. http://www.econ.cam.ac.uk/faculty/
>
> DCM V2.0 http://www.econ.cam.ac.uk/DCM2/
>
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/