Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Chart of Named Colors


From   "Alex Gamma" <[email protected]>
To   <[email protected]>
Subject   st: Re: Chart of Named Colors
Date   Wed, 26 Sep 2007 18:06:27 +0200

Tom,

the user-written command - palette_all - also shows Stata colors, on a grey or optionally black background. It doesn't show the gs* colors, though.

findit palette_all

Cheers,
Alex


----- Original Message ----- From: "Steichen, Thomas J." <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 26, 2007 5:55 PM
Subject: st: Chart of Named Colors



Listmembers,

I wanted a chart showing the named colors in Stata (because I can
never remember the exact names and I certainly can't recall the
differences in hue, etc. between related colors) so I wrote
some graph code into a -do- file to generate it. While the code
is nothing fancy, you may find it useful, so I show it below.

Paste the code into a do file and execute it and you'll get a chart.
(The code does not use nor modify any session data, so you can run
it at any time.)

The usual caution concerning line wraps applies, though I think
all of these are short enough.

Tom Steichen


*----- begin colors.do ----------------------------------------------------------
* Set Color Sequence
* Note: this code expects 75 entries in local -colors-
* - "none" is a placeholder; my Stata has 72 colors, so I use 3 placeholders
* - you may rearrange the colors and placeholders to suit your preference
* To see the graph code, change the -run- to -do- in the last line
*
local colors "gs0 gs1 gs2 gs3 gs4 gs5 gs6 gs7 gs8 gs9 gs10"
local colors "`colors' gs11 gs12 gs13 gs14 gs15 gs16 dimgray gray black"
local colors "`colors' dknavy navy8 navy edkblue emidblue eltblue ebblue"
local colors "`colors' midblue blue lavender cyan ltblue edkbg ebg bluishgray8"
local colors "`colors' ltbluishgray8 bluishgray ltbluishgray none none"
local colors "`colors' olive_teal eltgreen teal emerald forest_green dkgreen"
local colors "`colors' green midgreen lime mint sunflowerlime sandb yellow"
local colors "`colors' gold dkorange orange orange_red red cranberry pink"
local colors "`colors' magenta purple maroon erose none brown olive chocolate"
local colors "`colors' sienna sand khaki stone ltkhaki eggshell white"
* generate the graph code
tempname fh
tempfile fn
file open `fh' using `fn'.do, write
local k 0
forvalues y = 1/15 {
local y0 = `y' - 1
forvalues x = 1/5 {
local x0 = `x' - 1
local k = `k' + 1
local c : word `k' of `colors'
if `k' == 1 file write `fh' "graph tw ///" _n
file write `fh' `"|| scatteri `y' `x0' `y' `x', "'
file write `fh' `"base(`y0') fc(`c') lc(black) recast(area) ///"' _n
file write `fh' `"|| scatteri `y' `x0' (5) "`c'", "'
file write `fh' `"msym(i) mlabc(black) ///"' _n
if `k' == 75 {
file write `fh' "legend(off) xsca(off) ysca(off) xsiz(7.9) ysiz(10.6)" _n
}
}
}
file close `fh'
run `fn'.do
*----- end colors.do ----------------------------------------------------------

-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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