Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: any simpler way to add text to a graph


From   "Data Analytics Corp." <walt@dataanalyticscorp.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: any simpler way to add text to a graph
Date   Wed, 13 Apr 2011 11:05:03 -0400

I'll try this.  Thanks,

Walt

On 4/13/2011 10:44 AM, Scott Merryman wrote:
On Wed, Apr 13, 2011 at 8:52 AM, Data Analytics Corp.
<walt@dataanalyticscorp.com>  wrote:
Hi,

I created a simple graph that merely plots the means for a variable where
the means are based on a categorical variable.  I created the means using
collapse:

    collapse ocs, by(project)

I then added a variable to this data set as

    gen x = 0.5

and created the graph I want as

    scatter ocs x, xline(0.5)

I want to add a label next to each point, the label naming the project.  I
first added, as an example, text(0.49 0.45 "Project 1", place(w)) to the
scatter command.  That worked.  But I have 10 projects.  I would have to add
10 such text commands.  This is very inefficient.  Is there a better way?

-mlabel()- option?   See -help marker_label_options-

For example:

. sysuse auto,clear
(1978 Automobile Data)

. scatter mpg weight in 1/5, mlabel(make) mlabpos(9) mlabs(*.75)

Scott

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