Dear All,

I want to make a graph bar over a categorical variable (4 categories). My data looks as follows:

Code:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(avgdeloxy_mme_pc avgdeloxy_mme_pc_s pre_rateq)
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
-.0007063786  .01036684 1
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
 -.007270627 .011691254 2
 -.007270627 .011691254 2
  -.01886584 .012973787 3
-.0007063786  .01036684 1
  -.01886584 .012973787 3
   -.0551143  .01404232 4
  -.01886584 .012973787 3
 -.007270627 .011691254 2
 -.007270627 .011691254 2
 -.007270627 .011691254 2
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
   -.0551143  .01404232 4
  -.01886584 .012973787 3
 -.007270627 .011691254 2
  -.01886584 .012973787 3
   -.0551143  .01404232 4
  -.01886584 .012973787 3
   -.0551143  .01404232 4
 -.007270627 .011691254 2
  -.01886584 .012973787 3
   -.0551143  .01404232 4
 -.007270627 .011691254 2
   -.0551143  .01404232 4
  -.01886584 .012973787 3
-.0007063786  .01036684 1
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
  -.01886584 .012973787 3
-.0007063786  .01036684 1
 -.007270627 .011691254 2
 -.007270627 .011691254 2
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
  -.01886584 .012973787 3
  -.01886584 .012973787 3
 -.007270627 .011691254 2
   -.0551143  .01404232 4
   -.0551143  .01404232 4
-.0007063786  .01036684 1
  -.01886584 .012973787 3
  -.01886584 .012973787 3
   -.0551143  .01404232 4
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
  -.01886584 .012973787 3
 -.007270627 .011691254 2
   -.0551143  .01404232 4
 -.007270627 .011691254 2
-.0007063786  .01036684 1
  -.01886584 .012973787 3
-.0007063786  .01036684 1
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
 -.007270627 .011691254 2
  -.01886584 .012973787 3
  -.01886584 .012973787 3
 -.007270627 .011691254 2
  -.01886584 .012973787 3
  -.01886584 .012973787 3
-.0007063786  .01036684 1
   -.0551143  .01404232 4
  -.01886584 .012973787 3
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
   -.0551143  .01404232 4
  -.01886584 .012973787 3
 -.007270627 .011691254 2
   -.0551143  .01404232 4
  -.01886584 .012973787 3
  -.01886584 .012973787 3
   -.0551143  .01404232 4
   -.0551143  .01404232 4
 -.007270627 .011691254 2
 -.007270627 .011691254 2
   -.0551143  .01404232 4
 -.007270627 .011691254 2
end
I get what I am looking for using the following:
Code:
graph bar avgdeloxy_mme_pc avgdeloxy_mme_pc_s, over(pre_rateq, relabel(1 "Quartile 1" 2 "Quartile 2" 3 "Quartile 3" 4 "Quartile 4")) ytitle(∆ orig. OxyContin supply rate, margin(vlarge))
Unfortunately I am unable to use the legend option (like in a twoway graph option) to relabel the legend. What is the way to modify the legend in graph bar? Thank you in advance.

Sincerely,
Sumedha.