Announcement

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

  • Bar graph -relabel on the x axis

    Dear all,
    I wish to create a bar graph with 3 variables (inv_rate5 inv_rate10 inv_rate100), with a timeline in the 1903-1971 year range. I want to show year label every 5 years. I followed the suggestion provided by Cox (2021) to create a local to relabel the year values, but it does not seem to work in my case:

    local call
    forvalues j = 1903/1971 {
    local show = `j'
    if mod(`j', 5) local call `call' `j' "`show'"
    else local call `call' `j' " "
    }
    graph bar inv_rate5 inv_rate10 inv_rate100, stack over(anno, relabel(`call') label(angle(45) labsize(tiny)))



    References
    Cox, N. J. (2021). Stata tip 140: Shorter or fewer category labels with graph bar. The Stata Journal, 21(1), 263–271. https://doi.org/10.1177/1536867X211000032
    Attached Files

  • #2
    Dario:
    three posts on the very same topic sound like a bit of a stretch to me.
    Last edited by Carlo Lazzaro; 10 Jan 2023, 11:58.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X