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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: Re: st: placing two textboxes in a graph on the x-axis |

Date |
Sun, 28 Aug 2011 17:49:14 +0100 |

-xmlabel()- is documented under -axis label options-. That's where I would expect. Where did you look? You can move labels up or down by changing the length of the corresponding ticks. The objection is then likely to be that long ticks are not wanted. But when I want extra text I often just use -tlcolor(none)- to make the ticks invisible. And although the -?mlabel()- are born small they can be made bigger. So, for putting extra text on graph axes I often use -xmlabel()- or -ymlabel()- with long but invisible ticks and a big label size. . sysuse auto, clear (1978 Automobile Data) . scatter mpg weight . scatter mpg weight, xmla(4500 "4500") . scatter mpg weight, xmla(4500 "4500", tlength(*3)) . scatter mpg weight, xmla(4500 "4500", tlength(*6)) . scatter mpg weight, xmla(4500 "4500", tlength(*6) tlcolor(none)) . scatter mpg weight, xmla(4500 "4500", tlength(*6) tlcolor(none) labsize(*3)) In terms of Ariel's more general comments: 1. Do you mean something other than the Graph Recorder? 2. It seems inevitable that a fat manual documenting a complicated set of commands is a bit frustrating sometimes. I think StataCorp would want specifics of what is not documented and what is documented in puzzling places. Nick On Sun, Aug 28, 2011 at 5:18 PM, Ariel Linden, DrPH <ariel.linden@gmail.com> wrote: > Thank you Eric for your additional approach. I actually started out my quest > using the text option, however, as you correctly noted, it is not an easy > task trying to position the boxes (and it changes with every graph)! > > If I could suggest to Stata an addition to a future version, it would be to > "track" the commands used in the graph editor and display them in the same > way that all other commands are displayed (when using drop down menus > instead of directly writing in the command at the command line). There are > many options in graphing that are not intuitive or easy to find in the > manual (for example, I could not find xmlabel documented anywhere). > > One last question: is there a way to offset the xmlabel downward from the > x-axis? > > Thanks again for providing very useful advice! > > Ariel > > Date: Sat, 27 Aug 2011 20:47:18 +0000 > From: Eric Booth <ebooth@ppri.tamu.edu> > Subject: Re: st: placing two textboxes in a graph on the x-axis > > <> > > Maarten already gave a solution, but here's a solution using the textbox() > graph option you asked about in your original post (piggybacking on > Maarten's code). > The tricky part about textbox is tweaking the x-y coordinate placement of > the boxes. You can still place them below the axis using negative > coordinates. I find that it's easier to stylize textboxes the way I want > with shading, text direction, borders, etc, but sometimes it's a pain to get > them in just the right spot (especially when your scaling changes -- > manually setting the axis helps alleviate this issue). > > *-------------- begin example ------------------ > sysuse nlsw88, clear > replace grade = grade - 12 > > scatter ttl_exp grade , /// > text(-2.1 -2.8 "{bf:Favors Treatment}" "more text here", /// > orient(horizontal) si(small) justification(center) box ) /// > text(-2.1 2.8 "{bf:Favors Control}" "more text here", /// > orient(horizontal) si(small) justification(center) box ) /// > xtit("Grade Completed", size(small) margin(medlarge)) > *---------------- end example -------------------- > > - - Eric > __ > Eric A. Booth > Public Policy Research Institute > Texas A&M University > ebooth@ppri.tamu.edu > +979.845.6754 > > On Aug 27, 2011, at 9:36 AM, Ariel Linden, DrPH wrote: > >> Maarten, you are fantastic! This is exactly what I needed! I didn't even >> know about xmlabel. >> >> Thanks for your help! >> >> Ariel >> >> Date: Fri, 26 Aug 2011 10:02:38 +0200 >> From: Maarten Buis <maartenlbuis@gmail.com> >> Subject: Re: st: placing two textboxes in a graph on the x-axis >> >> On Thu, Aug 25, 2011 at 11:34 PM, Ariel Linden, DrPH wrote: >>> I would like to place 2 textboxes on the x-axis of a graph (one to the >> right >>> and one to left of the center point 0 where the xlabel would go) that > says >>> "benefits treatment" and "benefits controls" (as you'd see in a forest >>> plot). >> >> What about this? >> >> *-------------- begin example ------------------ >> sysuse nlsw88, clear >> replace grade = grade - 12 >> >> scatter ttl_exp grade , /// >> xmlab(-2.5 `""benefits" "treatment""' /// >> 2.5 `""benefits" "controls""', /// >> noticks labsize(medium) ) >> *---------------- end example -------------------- >> (For more on examples I sent to the Statalist see: >> http://www.maartenbuis.nl/example_faq ) * * 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/

**Follow-Ups**:**st: How to start a bar graph with a minimum other than 0***From:*Andrew Hsiao <ahsiao@newvisions.org>

**References**:**re: Re: st: placing two textboxes in a graph on the x-axis***From:*"Ariel Linden, DrPH" <ariel.linden@gmail.com>

- Prev by Date:
**RE: st: quasi-complete separation** - Next by Date:
**RE: st: quasi-complete separation** - Previous by thread:
**re: Re: st: placing two textboxes in a graph on the x-axis** - Next by thread:
**st: How to start a bar graph with a minimum other than 0** - Index(es):