[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: wrapping title with by option

From   "Michael Blasnik" <>
To   <>
Subject   st: Re: wrapping title with by option
Date   Fri, 20 Jul 2007 13:47:46 -0400

Although not exactly a "solution", you can directly edit the by-graph titles using the gr_edit command:

gr_edit .graphs[1].subtitle.text[1]=`"This is by group 1"'

will change the 1st line of the title of the 1st by-group graph

gr_edit .graphs[2].subtitle.text[2]=`"Hi There graph 2 line 2"'

will add a second line (text[2]) to the title of the second by-group graph (graphs[2])

So, it wouldn't be too hard to write an ado that would semi-automate this process to get multi-lined by-graph titles -- either by supplying a quote delimited list of titles or perhaps through some use of label languages(?). However, I'd have to agree with posts here that the graph is not very good as is and I'd also say that I prefer to keep shorter titles when working with multiples.

Michael Blasnik

----- Original Message ----- From: "Maarten buis" <>
To: <>
Sent: Thursday, July 19, 2007 4:38 PM
Subject: st: wrapping title with by option

I was trying to help these guys by
providing them with Stata code for some of their graphs (they requested
that here:

Anyhow I got already stuck on the first graph on what seems to be a
minor thing, the wrapping of the subtitles. I was trying to recreate
that graph with the -by()- option, but couldn't get the subtitles to

The subtitles are obtained from the value labels, and titles wrap by
feeding them two (or more) strings, so thought lets create value labels
with multiple strings, which is possible by surrounding them with
compound quotes. However, for once I think that the compound quotes
work too well, because when I create the graph they are treated as one
string. I realize that this is good behaviour, but it doesn't solve my
problem of how to wrap titles with the -by()- option. Does anyone have
any thoughts?

*--------------- begin example ----------------
sysuse auto, clear

label defin foreign 0 `""realy long" "title""' /*
               */  1 `""another" "long title""'
label value foreign foreign
twoway scatter pri mpg, by(foreign)
*---------------- end example ------------------


*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index