Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to force stata to use different line pattern


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: How to force stata to use different line pattern
Date   Mon, 1 Feb 2010 19:19:57 -0600

Taken from the trace of  -graph query linepatternstyle-, here is one
way to obtain a list of the line patterns:

local x : dir "C:\Program Files\Stata11\ado\base/style" files
"linepattern-*.style"
local x : list clean x
local x: subinstr local x "linepattern-" "", all
local x: subinstr local x ".style" "", all
local x: subinstr local x "blank" "", all
disp "`x'"

and then for each number of the by(variable) you could cycle through
local macro x to pick up a different line pattern.

Scott


On Mon, Feb 1, 2010 at 4:13 PM, Abdel Rahmen El Lahga
<[email protected]> wrote:
> I'm writing a new command that produce a graph and allow the use of by() option.
> However, given that I can not determine a priori the number of
> mofalities  of the by(variable)  I can not set the line pattern of the
> outputed graph.
> My question is how to force stata to use different line pattern in the
> graph. Below you find a piece of my ado file
>
> local listvar "`listvar' `newvar`i''"   // set the list of variable
> used in the graph
>
> ** and here is my graph command
>
> if "`graph'" != ""  {
>                        qui gen `p'=`pvar'
>                                label variable `p' "uniform distribution curve"
>                                gen byte `pe'=1
>                                label variable `pe' "perfect equality line"
>                                if `nv' > 1 {
>                                        local yti `"yti("`curvelabel' `varlist' (by `by')")"'
>                                }
>                                twoway scatter `listvar' `pvar' if `touse' , ///
>                                ms(i ..) c(l ..) `yti' legend(col(1)) `options'  || line `pe'
> `pvar' , lpattern(dot) || line `p' `p' , lpattern(dash_dot)
>                }
>
> --
> AbdelRahmen El Lahga

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index