Announcement

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

  • Place labels on boxplots with asyvars option

    I generate a hbox with

    Code:
    clear
    set obs `=9 * 2 * 5'
    set seed 2803
    gen y = rnormal()
    egen x1 = seq(), to(4) block(1)
    
    label define category 1 "First" 2 "Second" 3 "Third" 4 "Fourth"
    label val x1 category
    
    graph hbox y, nooutsides over(x1) legend(off) nofill note("")
    I would like to set different colors for each category. I do this with asyvars option. But then the labels disappear. Would really appreciate some help on restoring the labels in the vertical axis when using asyvars option. Or, alternatively, suggestions on how to place different colors without using asyvars option. I'm using Stata 13 on Windows 10.

    Code:
    clear
    set obs `=9 * 2 * 5'
    set seed 2803
    gen y = rnormal()
    egen x1 = seq(), to(4) block(1)
    
    label define category 1 "First" 2 "Second" 3 "Third" 4 "Fourth"
    label val x1 category
    
    graph hbox y, nooutsides asyvars over(x1) legend(off) nofill note("")
    Last edited by Gabriel Jardanovski; 17 Nov 2019, 11:27.

  • #2
    Code:
    graph hbox y, nooutsides asyvars over(x1) legend(off) nofill note("") showyvars

    Comment


    • #3
      Awesome, thank you very much Andrew!

      Comment

      Working...
      X