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 at the end of May, and its replacement, statalist.org is already up and running.


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

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


From   "Brent McSharry" <brent@focused-light.net>
To   "Statalist" <statalist@hsphsun2.harvard.edu>
Subject   st: ADO file to graph using features of the default scheme
Date   Sat, 8 May 2010 12:39:18 +1200

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?

Thankyou very much

Brent McSharry
Auckland, New Zealand
*
*   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