Announcement

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

  • Add a vertical line the height of the histogram

    I want to add a vertical line to a histogram, which is the whole height of the diagram. For example, this *almost* works.

    Code:
    use http://www.stata-press.com/data/r13/auto, clear
    
    //Histogram with a vertical line at 15, but need to know the right height
    histogram mpg, fraction addplot(pci 0 15 .35 15) legend(label(2 "My Threshold"))
    The problem is that the pci requires giving the height, and I have to eyeball it to .35. Is there a way to do this automatically, so that I can get a line the full height of plot? Obviously, I can tweak this for a given graph, but I am generating dozens of histograms of this type and it would be much easier to do it automatically.
Working...
X