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]

From |
"Ariel Linden, DrPH" <ariel.linden@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 12:18:54 -0400 |

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 ) > > Hope this helps, > Maarten > * * 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**:**Re: Re: st: placing two textboxes in a graph on the x-axis***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**RE: st: quasi-complete separation** - Next by Date:
**re st: sample size ?** - Previous by thread:
**Re: st: placing two textboxes in a graph on the x-axis** - Next by thread:
**Re: Re: st: placing two textboxes in a graph on the x-axis** - Index(es):