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

From |
Sam Norton <samjnorton@googlemail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: AW: Making scatterplot instead of box plot... |

Date |
Fri, 15 May 2009 11:30:46 +0100 |

I don't really understand what is wanted, but you might find Nick Cox's -stripplot- available from SSC helpful. For example, *** sysuse auto, clear stripplot mpg, over(foreign) box stack centre vertical // overlays box plot stripplot mpg, over(foreign) bar stack centre vertical // overlays mean and 95% CI *** Alternatively, to display mean with bars showing +/- 1SD you could: *** egen meanmpg = mean(mpg), by(foreign) egen sdmpg = sdmpg, by(foreign) gen lb = meanmpg - sdmpg gen ub = meanmpg + sdmpg stripplot mpg, over(for) box stack centre vertical addplot(sc meanmpg foreign || rcap lb ub foreign) *** hope this is useful Sam 2009/5/14 Martin Weiss <martin.weiss1@gmx.de>: > <> > > Ok, overlays between Stata graphs work best with the -twoway- family, but > -graph box- does not have membership status there. So let me guess what your > best shot at the prob could be: > > ************* > sysuse bpwide, clear > > //before > graph box bp_before,/* > */ over(sex) name(first, replace) /* > */ nodraw > > scatter bp_before sex, /* > */name(second, replace) nodraw > > //after > graph box bp_after,/* > */ over(sex) name(third, replace) /* > */ nodraw > > scatter bp_after sex, /* > */name(fourth, replace) nodraw > > //combine 'em > gr combine first second third fourth > ************* > > > > HTH > Martin > _______________________ > ----- Original Message ----- From: "Amr Al Sayed" <asyoussef@yahoo.com> > To: <statalist@hsphsun2.harvard.edu> > Sent: Thursday, May 14, 2009 11:58 PM > Subject: Re: st: AW: Making scatterplot instead of box plot... > > >> Dear Martin, >> Thanks for your help. I want complete representation of all the data set >> in the graph as scatter plot with added indicator bar showing the mean and >> sd of each scatter plot. >> >> I found your idea of combining box plot and graph bar in a single figure >> also working. Then, my question is: >> could you help me with making box plot and scatter plot (instead of bar >> chart) in a single figure? >> >> Thanks, >> Amr >> >> --- On Fri, 5/15/09, Martin Weiss <martin.weiss1@gmx.de> wrote: >> >>> From: Martin Weiss <martin.weiss1@gmx.de> >>> Subject: Re: st: AW: Making scatterplot instead of box plot... >>> To: statalist@hsphsun2.harvard.edu >>> Date: Friday, May 15, 2009, 12:45 AM >>> <> >>> >>> You can stack inside the -graph bar- >>> >>> *** >>> graph bar (mean) bp_before bp_after (sd) bp_before >>> bp_after, over(sex) stack >>> *** >>> >>> but apart from that, can you rephrase your request? I >>> really do not get what >>> you want... >>> >>> >>> >>> HTH >>> Martin >>> _______________________ >>> ----- Original Message ----- From: "Amr Al Sayed" <asyoussef@yahoo.com> >>> To: <statalist@hsphsun2.harvard.edu> >>> Sent: Thursday, May 14, 2009 11:27 PM >>> Subject: Re: st: AW: Making scatterplot instead of box >>> plot... >>> >>> >>> > Thanks Martin, >>> > It worked! However, I want to show the data as scatter >>> plot with all the >>> > values are represented as dots plus an indicator bar >>> beside every scatter >>> > blot to show the mean and sd. If it is not possible, >>> then I can use your >>> > idea of combining box plot with scatter plot as the >>> 2nd graph to the >>> > right. >>> > So, could you help with making scatter plot instead of >>> graph bar (on the >>> > 2nd graph) >>> > OR to add the sd value to the top of each graph bar as >>> a whiskers? >>> > >>> > Best regards, >>> > Amr >>> > >>> > --- On Thu, 5/14/09, Martin Weiss <martin.weiss1@gmx.de> >>> wrote: >>> > >>> >> From: Martin Weiss <martin.weiss1@gmx.de> >>> >> Subject: st: AW: Making scatterplot instead of box >>> plot... >>> >> To: statalist@hsphsun2.harvard.edu >>> >> Date: Thursday, May 14, 2009, 11:35 PM >>> >> >>> >> <> >>> >> >>> >> Not sure how a scatter plot can have bars, but >>> here is >>> >> something you could >>> >> try: >>> >> >>> >> >>> >> ************* >>> >> sysuse bpwide, clear >>> >> >>> >> graph box bp_before bp_after,/* >>> >> */ over(sex) name(first, replace) /* >>> >> */ nodraw >>> >> graph bar (mean) bp_before bp_after /* >>> >> */(sd) bp_before bp_after, over(sex)/* >>> >> */ name(second, replace) nodraw >>> >> >>> >> gr combine first second >>> >> ************* >>> >> >>> >> >>> >> >>> >> HTH >>> >> Martin >>> >> >>> >> >>> >> -----Ursprüngliche Nachricht----- >>> >> Von: owner-statalist@hsphsun2.harvard.edu >>> >> [mailto:owner-statalist@hsphsun2.harvard.edu] >>> >> Im Auftrag von Amr Al Sayed >>> >> Gesendet: Donnerstag, 14. Mai 2009 22:21 >>> >> An: Statalist >>> >> Betreff: st: Making scatterplot instead of box >>> plot... >>> >> >>> >> Dear all, >>> >> >>> >> I have simple problem with transforming a box plot >>> of two >>> >> continuous >>> >> variables (y1 and y2) measured over 4 time points >>> (x, with >>> >> x is a >>> >> categorical variable 0,1, 2, 3) into scatter graph >>> with bar >>> >> indicating their >>> >> means and standard deviation. The rationale is a >>> more >>> >> informative way of >>> >> data display. >>> >> >>> >> I used the stata command (Stata 9.2): graph box y1 >>> y2, >>> >> over(x) >>> >> >>> >> Could you help me to display my data as >>> scatterplot instead >>> >> of blind box? >>> >> >>> >> Regards, >>> >> Amr >>> >> >>> >> >>> >> >>> >> >>> >> * >>> >> * 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/ >>> >> >>> > >>> > >>> > >>> > >>> > * >>> > * 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/ >>> >> >> >> >> >> * >> * 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/ > -- Sam Norton samjnorton@gmail.com Research Student Centre for Lifespan & Chronic Illness Research University of Hertfordshire * * 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: AW: Making scatterplot instead of box plot...***From:*Sam Norton <samjnorton@googlemail.com>

**References**:**Re: st: AW: Making scatterplot instead of box plot...***From:*Amr Al Sayed <asyoussef@yahoo.com>

**Re: st: AW: Making scatterplot instead of box plot...***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: PWEIGHT question** - Next by Date:
**Re: st: AW: Making scatterplot instead of box plot...** - Previous by thread:
**Re: st: AW: Making scatterplot instead of box plot...** - Next by thread:
**Re: st: AW: Making scatterplot instead of box plot...** - Index(es):

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