Announcement

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

  • Gap in added text to graph

    Hi!

    I'm trying to annotate a histogram with the mean and sd. Here's a toy example:

    Code:
    sysuse auto, clear
    summarize mpg
    local mean: di %9.2fc r(mean)
    local sd: di %9.2fc r(sd)
    hist mpg, text(.08 30 "{&mu}:`mean', {&sigma}:`sd'")
    However, in the graph, there's a weird gap between mu and `mean', and between sigma and `sd'. Does anyone know how I can get rid of them?

    Thanks in advance!

    Click image for larger version

Name:	Graph_output.png
Views:	1
Size:	89.5 KB
ID:	1734112

  • #2
    Caused by your display format:

    di %9.2fc r(mean)
    Try


    Code:
    di %3.2fc r(mean)
    in this instance.

    Comment


    • #3
      A comment of a different kind is that you're using population notation for sample mean and SD.

      Comment

      Working...
      X