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

# RE: st: How to force stata to use different line pattern

 From "Nick Cox" To Subject RE: st: How to force stata to use different line pattern Date Tue, 2 Feb 2010 19:24:27 -0000

```Here is a secondary point.

Part of Abdel's code is

gen byte `pe'=1
label variable `pe' "perfect equality line"
line `pe' `pvar' , lpattern(dot)

It might be simpler just to add -yli(1, lp(dot))- as an option to the
other graph. The text "perfect equality line" could be added
independently.

Nick
n.j.cox@durham.ac.uk

Abdel Rahmen El Lahga

thank you Scott!

2010/2/2, Scott Merryman <scott.merryman@gmail.com>:
> 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
> <rahmen.lahga@gmail.com> 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)
> >                }

*
*   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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index