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 on April 23, and its replacement, is already up and running.

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

RE: st: incorporate table into figure

From   "Trelle Sven" <>
To   <>
Subject   RE: st: incorporate table into figure
Date   Wed, 25 Aug 2010 16:21:42 +0200

The approach previously described using markerlabels can be used for
this. Here is an example
The resulting plot shows text on the left (in variable "prep_label") and
text, in this case risk ratios plus 95% CI, on the right of the forest
plot (in variable "result"). variables "resultpos" and "prep_label_pos"
determine where the text is positioned on the x-axis. The xscale option
"noline" prevents Stata from drawing the x-axis. Why, because the x-axis
will not only be drawn from 0.1 to 10 (see xlabel) but from 0.01 to 100
(see xscale). 
I usually import the graph in Powerpoint, de-group it and connect the
outer ticks, group it again and save it again as emf-file. That's the
only manipulation necessary. If you don't care about the x-axis line
just delete the "noline" option.


*** example starts
twoway scatter prep med, mcolor(black) msymbol(O) ///
  || rspike lower upper prep, lcolor(black) horizontal ///
  || scatter prep resultpos, msymbol(i) mlabel(result) mlabposition(3)
mlabgap(2) mlabsize(medium) mlabcolor(black) ///
  || scatter prep prep_label_pos, msymbol(i) mlabel(prep_label)
mlabposition(9) mlabgap(2) mlabsize(medium) mlabcolor(black) ///
	yscale(r(0.5 8.25) rev off) ///
	xscale(r(0.01 100) log noline) xlabel(0.1 0.2 0.5 1 2 5 10,
labsize(medium) format(%03.1f)) xline(1, lcolor(black) lpattern(dash)
lwidth(thin)) ///
	scheme(s1color) title("`title'", justification(left) bexpand)
plotregion(lstyle(none)) legend(off) name(forest, replace)
graph export "$gd\forest.emf", replace
*** example ends

-----Original Message-----
[] On Behalf Of Jeph Herrin
Sent: Tuesday, August 24, 2010 5:07 PM
Subject: Re: st: incorporate table into figure

My last post on this was so fruitful, I am trying another - in this case
I need to add a table on the left, so

is there some helpful option or table type I am overlooking?

I know that the previous advice about merging a graph with a table
inside a Word document (for example) will apply, just wondering if there
is a more direct way as I may have to revise this figure many many


On 8/23/2010 9:44 PM, Jeph Herrin wrote:
> I would like to incorporate a very simply (4x2) table into a figure. I

> would like the 4 columns to line up with the four ticks on the x-axis,

> but appearing below the axis. The row labels thus need to be in the 
> left margin. In particular, I need to reproduce a figure such as one 
> of these
> and the issue is lining up the numbers across the bottom.
> I have tried to set it up as a -caption()- with two strings, but have 
> two problems. First, I cannot persuade the caption to be aligned with 
> the left side of the graph; -span- only aligns with the left edge of 
> the y-axis lable, whereas I have set the margin to be extra wide with 
> -graphreg(m())-. Second, there seems to be no way other than 
> experiment to align the 4 columns with 4 ticks on the x-axis. In the 
> graph editor there is a "position offset" for the caption box which I 
> can set to <0 to achieve what I want, but I cannot find any 
> corresponding textbox_option.
> Jeph
> *
> * For searches and help try:
> *
> *
> *
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index