Hello all. Currently, my goal is to have the bar graph code below to color code the observations below based on the variable GROUP and to have a legend associated with the variable GROUP with its associated colors. Below is a data example:
The code below generates a horizontal bar chart. I'd like for the observations to be colored based on the variable GROUP and to have an associated legend plot.
Unfortunately, I haven't found out how to accomplish this using by() and another over() option. Thank you for your time.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str5 NAME float TIMEHRS str12 GROUP "John" .5 "Experienced" "Dilly" 1.1 "Intermediate" "Bob" 1.7 "Beginner" "Josh" 1.5 "Beginner" end
Code:
graph hbar TIMEHRS, over(NAME) bar(1, color(blue)) l1title("Subjects") b1title("Time to complete task") /// ytitle(, size(tiny)) subtitle("Subjects completing task (N=4)")
Comment