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]

st: RE: Moving legends in combined graphs


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Moving legends in combined graphs
Date   Wed, 17 Mar 2010 20:46:10 +0100

<>

How do these graphs come into being? In your example, you reuse the "a"
graph three times, but in reality I bet you have different ones. Note that
with the -by- option, you do get a nice placement for the -legend-:


*************
sysuse auto, clear
tw (scatter mpg price), by(, legend(on position(0) at(6))) by(rep78)
*************


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Winter
Sent: Mittwoch, 17. März 2010 19:51
To: Stata List
Subject: st: Moving legends in combined graphs

Hi,

I'm trying to automate a modification to -grc1leg-, to move the single 
legend into a "hole" in the combined plot.  There are two ways I can get 
what I want:


sysuse auto, clear
gr two scatter mpg mpg price, name(a, replace) legend(col(1))

* Way One
grc1leg a a a , ring(0) pos(4) name(drag)
gr_edit .legend.DragBy 21 -15

* Way Two
grc1leg a a a , ring(0) pos(4) name(setmargin)
gr_edit .legend.style.editstyle boxmargin(0 15 20 0) editcopy


So my question is whether anyone can give me advice on automating 
figuring out the amount to drag (method 1) or the size of margins needed 
(method 2) to put the legend in the middle of an arbitrarily specified 
hole in the grid of plots?

Ideally I'd like to be able to do something like:

   grc1leg a a a a a, hole(5) putlegend(5)

Which I can achieve by trial and error with

   grc1leg a a a a a, hole(5) ring(0)
   gr_edit .legend.DragBy 21 0


which moves the legend to the middle of the hole created by the hole() 
option.  But to do that I need to figure out the size of the legend, and 
the size of the hole, I'd guess.

Thanks for any thoughts.

Nick Winter

-- 
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
S385 Gibson Hall, South Lawn  Map: http://tinyurl.com/uvaSLmap
*
*   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/


*
*   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