Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: RE: Installing symbolstyles


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Re: RE: Installing symbolstyles
Date   Thu, 20 Oct 2005 10:24:16 +0200

> > Eric G. Wruck
> >> Is it possible to install a new symbolstyle (symbolstyles are the
> >> circles, triangles, squares & so forth that can be used to mark
> >> observations in a graph)?  If so, how does one go about doing so?

Michael Blasnik wrote:
> I'd like to expand a little on Nick's 1st suggestion.  You can actually get
> at quite a variety of symbols by defining a variable that contains the
> symbol you want and using marker labels.  It takes some experimentation,
> but if you can find a font that has the symbol you want, you can usually
> get it into a Stata graph as the marker.   For example, I found that
> char(186) is the paragraph symbol in my default font, so:
>
> gen str1 c186=char(186)
> gr tw scatter mpg weight, mlab(c186) mlabpos(0) msym(i)
>
> The resulting graph uses the paragraph symbol instead of a regular marker.
> If you want to access some more esoteric symbol that isn't in the default
> font's character set, you can change the font used in the graph window by
> using Graph-Preferences.

Nick Cox wrote:
> You can
>
> 1 use printable characters within marker label variables 
>
> 2 -separate- into classes and use e.g. different colours
> or grayscales 
>
>and  
>
> 3 experiment with overstriking existing symbols. 
>
> (snip) I think those are the only alternatives. 
>
> The experiments I have seen on 3 were not encouraging, 
> but this revolves partly on matters of taste. 

Just for completeness here are the experiments with overstriking existing 
symbols. Besides the taste-issue, one problem is to get a legend for the 
"new" symbols (and this also applies for Michaels suggestion). The 
code-snipped below uses "legend-graph" as a workaround. This however is "at 
best, a kludge", as Nick pointed out in a private email exchange.

----------------------------------------------------------------
sysuse auto, clear
separate mpg, by(rep78)

// The Data-Graph
sc mpg1 mpg2 mpg3 mpg3 mpg4 mpg4 mpg5 mpg5 weight,             ///
    ms(Oh O Oh o Oh + O +)                                     ///
    mcolor(black black black black black black black white)    ///
    msize(*1.5 *1.5 *1.5 *.5 *1.5 *1.5 *1.5 *1.5)              ///
    legend(off) name(g1, replace)

// The Legend-Graph
tw scatteri 2 1 (3) "Very Low", ms(Oh) mcolor(black) msize(*1.5)       ///
|| scatteri 2 2 (3) "Low", ms(O) mcolor(black) msize(*1.5)             ///
|| scatteri 2 3 (3) "Intermediate", ms(Oh) mcolor(black)  msize(*1.5)  ///
|| scatteri 2 3, ms(o) mcolor(black) msize(.3) msize(*.5)              ///
|| scatteri 1 1 (3) "High" , ms(Oh) mcolor(black) msize(*1.5)          ///
|| scatteri 1 1, ms(+) mcolor(black) msize(*1.5)                       ///
|| scatteri 1 2 (3) "Very High", ms(O) mcolor(black)  msize(*1.5)      ///
|| scatteri 1 2, ms(+) mcolor(white) msize(*1.5)                       ///
|| , legend(off) xscale(off range(0.5 4.5)) ylabel(, nogrid)           ///
     yscale(off) fysize(10) fxsize(80) name(g2, replace)

graph combine data legend, rows(2) iscale(*1.3)
----------------------------------------------------------------------------

many regards
uli

-- 
[email protected]
+49 (030) 25491-361
*
*   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