Announcement

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

  • Reproducing a graphic

    Hi Statlist,

    I have the following mini dataset
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float Year double(recalled_class_one recalled_class_two)
    2004  6  38
    2005  2  86
    2006  9  48
    2007  3  65
    2008  4 102
    2009 10 117
    2010  7 128
    2011 21 193
    2012 15 143
    2013 20 188
    2014 31 163
    2015 19 138
    end
    and would like to reproduce (of course with my numbers) the following graphic of which I give the url since it seems that I am not able to properly upload the image: https://en.wikipedia.org/wiki/Drug_r..._in_the_US.jpg

    So I would like basically, given my data, to put on the x-axis all years (from 2004 to 2015) and on the y-axis the number of recalls. The resulting graphic should be a "double histogram" where histogram of a color indicates recall of class one for a year and the other color recalls of class two in that same year.
    Is it possible? If so, can you also give me a good reference to study how to build graphics in STATA?

    Thank you very much,

    Federico


  • #2
    Thanks for the data example.

    Code:
    label var recalled_class_one "Class 1"
    label var recalled_class_two "Class 2"
    graph bar (asis) recalled* , over(Year)
    should help.

    The best reference by far for graphics in Stata (NB spelling FAQ Advice #18) is the Graphics manual [G]. Almost everything almost everyone outside StataCorp knows about graphics is based on reading and applying what is documented there.

    Comment


    • #3
      Many thanks again!

      Comment

      Working...
      X