Announcement

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

  • graph hbar

    Dear Profs and Colleagues,

    I have a string variable nacio, which shows nationality and years 2010-2019. I am going to graph hbar looks like: The horizontal line be year and the vertical be the nationalities.
    Click image for larger version

Name:	nacio.png
Views:	1
Size:	32.2 KB
ID:	1745664

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 nacio double year
    "UA" 2010
    "ES" 2010
    "BR" 2010
    "FR" 2010
    "BR" 2010
    "BR" 2010
    "RU" 2010
    "MD" 2010
    "RO" 2010
    "RO" 2010
    "RO" 2010
    "BR" 2010
    "BR" 2010
    "BR" 2010
    "UA" 2010
    "CN" 2010
    "CN" 2010
    "CN" 2010
    "CN" 2010
    "UZ" 2010
    "GN" 2010
    "BR" 2010
    "AO" 2010
    "BR" 2010
    "MD" 2010
    "BR" 2010
    "VE" 2010
    "UA" 2010
    "BR" 2010
    "BR" 2010
    "RO" 2010
    "RO" 2010
    "BR" 2010
    "BR" 2010
    "ST" 2010
    "RU" 2010
    "ST" 2010
    "ST" 2010
    "ST" 2010
    "CV" 2010
    "UA" 2010
    "PK" 2010
    "UA" 2010
    "UA" 2010
    "UA" 2010
    "BG" 2010
    "BR" 2010
    "UA" 2010
    "BR" 2010
    "BR" 2010
    "RO" 2010
    "RO" 2010
    "UA" 2010
    "RO" 2010
    "AR" 2010
    "BR" 2010
    "UA" 2010
    "UA" 2010
    "RO" 2010
    "BG" 2010
    "BG" 2010
    "BG" 2010
    "RO" 2010
    "BG" 2010
    "BG" 2010
    "UA" 2010
    "BR" 2010
    "UA" 2010
    "FR" 2010
    "ES" 2010
    "BG" 2010
    "BG" 2010
    "BR" 2010
    "RO" 2010
    "CV" 2010
    "BR" 2010
    "UA" 2010
    "UA" 2010
    "UA" 2010
    "GB" 2010
    "UA" 2010
    "UA" 2010
    "RO" 2010
    "UA" 2010
    "UA" 2010
    "BR" 2010
    "VE" 2010
    "FR" 2010
    .
    .
    .
    end
    Any ideas appreacited.

    Cheers,
    Paris

  • #2
    You didn't get any quick replies. Perhaps others like me couldn't see any obvious link between the graph you show and your data description.

    The data example shows only 2010 in any case. Perhaps you want something like

    Code:
    . bysort nacio : gen freq = _N
    
    . graph hbar freq, over(nacio, sort(1) descending) ytitle(Frequency by country) ysc(alt)

    Comment

    Working...
    X