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

Re: st: Symbols on graph and legend

From   Gary Longton <>
Subject   Re: st: Symbols on graph and legend
Date   Mon, 23 Feb 2009 15:35:00 -0800

Allan Reese (Cefas) wrote:

Using v9, so apologies if this is cured immediately I upgrade.

I have a scatterplot with groups of points identified by symbols.  The
symbols on the graph have been made small ( msize(small) ) but I'd like
those in the legend to be larger.  Option symxsize changes the amount of
linepattern shown and symysize changes the line spacing, but there seems
no option that makes the just the keyed symbols bigger.

I'm not aware of a straightforward option to modify legend marker characteristics independent of their appearance in the plot. I'm guessing this may be by design rather than oversight? symxsize() and symysize() concern space allowed for the key/symbol, rather than the symbol size, as you note.

However, there is a way to achieve the same end with a back door approach: Include additional *ghost* plots in the graph and substitute their marker characteristics with the legend order() and label() options.

Building on Friedrich's example:

.sysuse auto

.twoway (scatter mpg weight if foreign==0, m(o) mc(orange)) ///
        (scatter mpg weight if foreign==1, m(o) mc(green))  ///
        (scatter mpg weight if mpg==., m(o) mc(orange) msize(*3)) ///
        (scatter mpg weight if mpg==., m(o) mc(green)  msize(*3)), ///
         legend(order(3 4) label(3 domestic) label(4 foreign))

- Gary
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index