Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: ADO file to graph using features of the default scheme


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: ADO file to graph using features of the default scheme
Date   Sun, 9 May 2010 19:07:27 +0100

The current scheme is detectable as c(scheme). 

Even so, this doesn't seem especially easy as many scheme definitions
just signal variations from some named scheme, so you'd need to look
beyond the scheme file defining c(scheme) in many cases. 

My attitude tends to be Olympian here. I don't feel any guilt in
choosing colours as program writer so long as users have hooks to change
them to what they wish. 

Evidently you know about [G] pstyle. 

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

Brent McSharry

I am using Stata/IC 10.1 for Windows.

I am writing an .ado program in which several models are plotted  on a 
twoway graph, plotting each model's observed against expected outcome, 
divided into quantiles of risk (a graphical hosmer lemeshow goodness of 
fit - displaying 1 or more models) . Each model will have a scatter
markers, 
rcap (denoting confidence interval), line (of best fit, frequency
weighted) 
and label (stating the number of observations in that quantile). Thus 3 
different plot types are associated with each model. I would like each
model 
(and the associated 3 different plot types + marker label) to have the
same 
color, and each new model to have a different colour (or grayscale) for
all 
of its associated plot types.

One solution I can see is to create a macro with the names of the colors
to 
cycle through (for each model), and assign the same color option in turn
to 
each plot type eg:
local colorcycle red blue green ...
forvalues i=1/`novars' {
    local coloroption: word `i'  of `colorcycle'
    local scatmac `scatmac' (scatter..., mcolor(`coloroption'))
    local rcapmac `rcapmac' (rcap..., lcolor(`coloroption'))
    }

Another is to create a scheme file with the same colours in turn for
each 
plot type eg:
p1line red
p2line blue
p1scatter red
p2scatter blue

However, either option will negate the users default scheme (and the
second 
option is not as useful for distributing the ado file to other users).
Is 
there any way in Stata to find the color p1 p2 p3 etc in the scheme
which is 
active at the time of execution of an ado file?


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index