Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: copy graph legend


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: copy graph legend
Date   Wed, 9 May 2012 21:39:02 +0100

Use a local macro for your legend definition.

Here's a dopey example:

sysuse auto, clear

local mylegend "legend(pos(3) col(1))"
local myytitle "Turn circle (ft) and trunk space (cu. ft)"

forval i = 1/5 {
	scatter turn trunk weight if rep78==`i', ///
	ytitle(`myytitle') subtitle(Repair record `i') `mylegend'
	more
}


On Wed, May 9, 2012 at 9:28 PM, Eric M. Uslaner <[email protected]> wrote:

 I am generating a set of similar graphs and I don't like the legend
Stata automatically produces.  I spent considerable time formatting
the legend in the first graph.  If at all possible, I would like to
copy the legend and replace legends in graphs 2-4 with the legend I
created for graph 1.  I searched for help and could not find a
solution.  If I could recover the commands for the edited legend in
graph 1, I could redo the other graphs with the revised legend in the
command line since the rest of the graph is barely edited from what
Stata generates.  I have read the manual on legends--and larning all
of the comands would take a lot more time than editing each one.  I am
hoping (though not so optimistically) for a simple solution.

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