Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Trelle Sven" <strelle@ctu.unibe.ch> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: incorporate table into figure |
Date | Tue, 24 Aug 2010 09:37:21 +0200 |
Hi Jeph If you wish to put persons at risk you could use "sts graph" with the "risktable" option. For other graphs you could try to use a scatterplot with invisible markers but superimposed labels showing your numbers. Below is a sample code showing a fitted line (first line in code) plus actual corresponding data points (second line in code) on a percentage scale with absolute numbers in a table (third line in code; "yvaluef" is the position of the table line on the y-scale, always the same value for the different years ...; actual numbers are in a string variable "female"; The title for the table line is included using the text option). Note however that the table will be shown within the plot region not below (although there might be ways to change this). * example starts; extract of more complex graph line standfempred year, sort lcolor(red) /// || scatter year basisjahr, msymbol(o) mcolor(red) /// || scatter yvaluef year, msymbol(i) mlabel(female) mlabcolor(red) mlabposition(9) mlabgap(-3.8) mlabs(small) /// yscale(r(1 3.8)) ylabel(1 "Reference" 2 "100%" 3 "200%" 4 "300%") ymtick(1(0.5)3.8) xscale(r(-2.5 14.6)) xlabel(0 "1993/4" 4 "1997/8" 8 "2001/2" 12 "2005/6") xmtick(0(2)14) ytitle("Change") xtitle("Year") text(0.75 -1 "Females", place(w) color(red) size(small)) legend(off) scheme(s1color) name(standpred, replace) * example ends Sven -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jeph Herrin Sent: Tuesday, August 24, 2010 3:45 AM To: statalist@hsphsun2.harvard.edu Subject: st: incorporate table into figure 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 http://jama.ama-assn.org/cgi/content/full/301/14/1439/JOC90023F2 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: * 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/