Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I get a box plot so plots of the same variable are next to each other instead of grouped by the category variable?

    I'm trying to get a box plot comparing multiple variables over one category that is organised so that the box plots of one variable are next to each other instead of grouped by category. For instance, if you use the following code

    Code:
    sysuse auto, clear
    graph box price weight displacement, over(foreign)
    you see Price Weight and Displacement of the Domestic Category followed by Price Weight and Displacement of the Foreign Category

    I need the box plot to be grouped by variables instead, so it would appear in the following order Price - Domestic and Foreign, Weight - Domestic and Foreign, Displacement - Domestic and Foreign


    Is there a way to do this? I have tried using asyvars, but it doesn't appear to work.
    Thanks

  • #2
    http://www.stata-journal.com/article...article=gr0062

    http://www.statalist.org/forums/forum/general-stata-discussion/general/1374566-multiple-box-plots-on-one-graph-by-another-variable-sequentially


    also consider

    Code:
    . graph box price, over(foreign) name(g1)
    
    . graph box weight, over(foreign) name(g2)
    
    . graph box displacement, over(foreign) name(g3)
    
    . graph combine g1 g2 g3, row(1)
    Last edited by Nick Cox; 31 May 2017, 10:13.

    Comment

    Working...
    X