Announcement

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

  • Multiple graphs in one page

    Hello Statalist,

    I need your assistance in producing a combined graph. I have data for 6 groups as below;

    Code:
     
    2010 2011 2012 2013
    Group 1 100.8 87.45 94.93 106.05
    Group 2 655.81 615.21 536 648.74
    Group 3 420.73 355.94 383.81 508.72
    Group 4 153.87 142.38 133.2 123.47
    Group 5 109.12 174.18 106.02 96.36
    Group 6 68.78 74.66 46.14 43.27
    I would like to include multiple graphs in one page for my groups to save space in my paper. A graph as below would be ideal;
    Click image for larger version

Name:	graph issue statalist .jpg
Views:	1
Size:	77.5 KB
ID:	1354637




    Where 2010-13 are years, and 100-600 are scores of each group in the given year.

    I tried to do it with -graph- and -histogram- command but could not able to produce what i wanted. Would you please say how may i do so?

    Kind Regards,
    Dias

  • #2
    Administrative bump, post failed to be displayed on Statalist General index page.

    Comment


    • #3
      Code:
      twoway bar something year, by(group)
      Whether you need to restructure your data first is an open question, as you don't really tell us anything about it.

      Please do read and act on FAQ Advice #12. http://www.statalist.org/forums/help#stata

      Comment


      • #4
        Dear NIck,

        Thank you for your response.

        I followed your recommendation and got a graph like this;

        Code:
        twoway bar score year, by(group)
        Click image for larger version

Name:	Graph for stata.png
Views:	1
Size:	34.7 KB
ID:	1354904



        There is one thing here; Even though i dont have year 2014 in my data, it is shown in the graph. Do you know how may i skip it and show bars for each year instead (2010,11,12,13)?

        And there are two more things i needed that i had not noted in my post. Do you know how may i report simple average score for each group in the y axis of graphs?

        And 400 is benchmark value for the groups: if they get more than 400, they get prizes in each year. Would it be possible to draw a horizontal line starting from 400 for each group? I did not find any reference for these in the -twoway graph- help file.

        Kind Regards,
        Dias



        Comment


        • #5
          Here is some technique:

          Code:
          clear
          input group year score
          1 2010   200
          1 2011   250
          1 2012   300
          1 2013   350
          2 2010   400
          2 2011   450
          2 2012   500
          2 2013   550
          end
          egen mean = mean(score), by(group)
          twoway bar score year, by(group)  barw(0.95) base(0) || line mean year, xla(2010/2013) lcolor(blue) yli(400, lcolor(red))
          See

          Code:
          help added line options
          help axis label options
          help twoway bar
          Last edited by Nick Cox; 31 Aug 2016, 02:33.

          Comment

          Working...
          X