Announcement

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

  • Graph changing x-axis label

    Hi,
    I´m creating the follwing graph in a loop
    Code:
     graph bar commitment_amount_usd_constant if group_recipient_sector == `i', over(year)
    However, the resulting Graphs look pretty squeezed, therefore I would like to change the labeling of the x-axis
    I tried the following Option
    Code:
    xlabel(1973(5)2013)
    to Display every fifth year, which did not work, furthermore I would like to Change the lables from horizontal to vertical.
    Any help would be greate!


  • #2
    Such graphs have no x axis.

    This is just a bar chart of means over time. I wouldn't do it this way.

    Here is some technique. Absent a data example, I just call up a sandbox:

    Code:
    webuse grunfeld
    
    * mess! 
    graph bar invest, over(year)
    
    * more flexible 
    egen mean = mean(invest), by(year)
    twoway bar mean year
    twoway bar mean year , barw(0.8) ytitle(mean investment)
    Wanting to change time axis labels to vertical is a sure sign that there's a much better way to work.

    In your case, you would want to start with something like

    Code:
     
     egen mean = mean(commitment_amount_usd_constant) , by(group_recipient_sector year)
    Depending on how many sectors you have, a single graph may even be possible.

    Comment

    Working...
    X