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: marginsplot, editing addplot legend entries


From   "Fiedler, James (JSC-SK)[UNIVERSITIES SPACE RESEARCH ASSOC-DIV OF SPACE LIFE SCIENCES]" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: marginsplot, editing addplot legend entries
Date   Wed, 25 Jan 2012 14:00:35 -0600

Rob's reply:

Thank you Scott. I had tried the analog of this earlier, without success, but because yours worked I figured out what the problem was.

In case anyone else runs into a similar problem and mistakenly thinks -marginsplot- is the problem, here is what happened. In my graph, there are many things that have a legend number but aren't actually being displayed by the legend. So, what I was seeing as the 6th or 7th item actually had a much higher number.

Rob

________________________________________
From: [email protected] [[email protected]] On Behalf Of Scott Merryman [[email protected]]
Sent: Wednesday, January 25, 2012 12:30 PM
To: [email protected]
Subject: Re: st: marginsplot, editing addplot legend entries

Here is one way:

sysuse auto, clear
reg price mpg i.foreign
margins foreign, at(mpg=(15(5)35))
marginsplot,   addplot(scatter price mpg , ///
 legend(order(3 "some" 4 "label" 5 "scatter")))

Scott

On Wed, Jan 25, 2012 at 11:49 AM, Fiedler, James (JSC-SK)[UNIVERSITIES
SPACE RESEARCH ASSOC-DIV OF SPACE  LIFE SCIENCES]
<[email protected]> wrote:
> I am sending this message for Rob Ploutz-Snyder, who is having trouble submitting messages to Statalist.
>
> James Fiedler
>
>
> His message:
>
>
> Greetings Statalisters.
>
> I'm having difficulty getting my legend labels to work with -marginsplot, addplot(scatter blahhh)-. No matter what I try I am unable to change the labels in the ADDPLOT portion.
>
> I saw Nick Winter's and Scott Merryman's replies to David Muller's post in November {Subject: st:marginsplot ignores label() sub-option in legend} that recommended:
>
> -marginsplot, plot( , label("some" "label"))- and -marginsplot, legend(order(3 "some" 4 "label"))-
>
>
> I can verify that those indeed change the labels for the marginsplot itself, but I can't seem to make that code alter the labels for whatever was added with the addplot option.
>
> I've tried putting legend(lab()) inside the addplot but it gets ignored.  I've tried using the same outside of the addplot() but that doesn't work either.  I've tried putting legend options inside the plotopts() and again, no success.
>
> How can we gain control of the legend labels for the addplot portion of marginsplot??
>
> Thanks in advance!
> Rob

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