fork download
  1. * Load example dataset
  2. sysuse auto, clear
  3.  
  4. * Create a full, customized histogram
  5. histogram mpg, ///
  6. frequency /// Frequency instead of density
  7. width(2) /// Set bin width
  8. start(10) /// Set start point
  9. addlabel /// Label bars with frequency
  10. addlabopts(mlabsize(small) mlabcolor(black)) /// Format labels
  11. normopts(lcolor(red) lwidth(medium)) /// Normal distribution line styling
  12. normal /// Add a normal distribution curve
  13. title("Distribution of MPG") /// Main title
  14. xtitle("Miles per Gallon") /// X-axis label
  15. ytitle("Frequency") /// Y-axis label
  16. color(navy*0.8) /// Bar color
  17. fintensity(inten80) /// Intensity of color
  18. ylabel(, angle(horizontal)) // Make labels horizontal
  19.  
Success #stdin #stdout 0.02s 25836KB
stdin
Standard input is empty
stdout
* Load example dataset
sysuse auto, clear

* Create a full, customized histogram
histogram mpg, ///
    frequency /// Frequency instead of density
    width(2) /// Set bin width
    start(10) /// Set start point
    addlabel /// Label bars with frequency
    addlabopts(mlabsize(small) mlabcolor(black)) /// Format labels
    normopts(lcolor(red) lwidth(medium)) /// Normal distribution line styling
    normal /// Add a normal distribution curve
    title("Distribution of MPG") /// Main title
    xtitle("Miles per Gallon") /// X-axis label
    ytitle("Frequency") /// Y-axis label
    color(navy*0.8) /// Bar color
    fintensity(inten80) /// Intensity of color
    ylabel(, angle(horizontal)) // Make labels horizontal