Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Cohen, Elan" <cohened@upmc.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: location of text/textbox in plot |

Date |
Fri, 28 Oct 2011 18:38:35 +0000 |

Thank you Nick. The -legend()- solution was very clever. I never realized there was a way to display free text. Along with -region(style(none))-, this does exactly what I want. - Elan -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Friday, October 28, 2011 2:22 PM To: 'statalist@hsphsun2.harvard.edu' Subject: RE: st: location of text/textbox in plot In a sense the whole point of the -text()- option is to put text at a specified absolute location in terms of the two variables being plotted. It is clear why you want to subvert that, but Stata's algorithms are a little complicated, given explicit and implicit requests for axis scales together with label and tick positions. That said, if you are not using the -legend()- option, this is a different technique: . sysuse auto (1978 Automobile Data) . scatter mpg weight, legend(on order(- "text here") pos(11) ring(0)) Although it's not documented as such in recent manuals, as far as I can recall, this article is still of some relevance STB-25 dm28 . . . Calculate nice numbers for labeling or drawing grid lines (help nicenum if installed) . . . . . . . . . . . . . . . J. W. Hardin 5/95 pp.2--3; STB Reprints Vol 5, pp.19--20 Nick n.j.cox@durham.ac.uk Cohen, Elan Thank you. I've read that article before. While it explains some of Stata's behavior, it doesn't explain the "choose-a-nice-number routine" (Stata's words, see -help axis_label_options-) which I believe is what I'm after. I'm creating a couple of dozen plots so manually determining the ranges & labels is not an options. The way I see it, I either need to understand the choose-a-nice-number routine (it doesn't seem to be public information) so I can extract the "nice" ranges or it would convenient to have -ring()- and -position()- suboptions similar to -legend()-. Eduardo Pérez Pérez This article describes how Stata chooses the x and y ranges: http://www.stata-journal.com/sjpdf.html?articlenum=gr0019 Once you specify the -range- and -label- options of your graph, Stata will not override your values (unless you are asking for too narrow ranges according to your data and labels), and you can place your text in the right place. On Fri, Oct 28, 2011 at 11:17 AM, Cohen, Elan <cohened@upmc.edu> wrote: > I'm trying to add text to the upper left of my scatter plot via the -text()- option. However, because Stata chooses the x and y ranges to be neat, there's no way for me to know exactly what the minimum x value & maximum y value are. If I simply choose these values from my data, the text box is always closer to the center than I'd like. > > Is there a way to obtain this information from Stata? Alternatively, is there an option to place the textbox in the upper left? * * 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/

**Follow-Ups**:**Re: st: location of text/textbox in plot***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**Re: st: location of text/textbox in plot***From:*Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co>

**RE: st: location of text/textbox in plot***From:*"Cohen, Elan" <cohened@upmc.edu>

**RE: st: location of text/textbox in plot***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: local variables and running do files** - Next by Date:
**st: robust covariance conditional Xs (say, for a population) : how to add** - Previous by thread:
**RE: st: location of text/textbox in plot** - Next by thread:
**Re: st: location of text/textbox in plot** - Index(es):