Announcement

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

  • create title of categorical axis in hbar

    In the program

    PHP Code:
    sysuse auto
    collapse price
    by(foreign)
    graph hbar priceover(foreign
    I would like a header ("Origin:") directly over the horizontal bar labels ("Domestic" and "Foreign") in hbar.

    (for conformity with other graphs in a series of graphs I prefer this way of explaining the meaning of the category labels to other ways, e.g. by titling the whole graph by "Mean price by origin".
    In my problem the header is sth like "Creation or maintainance of..." and the labels are "Lakes or ponds", "walls or terraces of natural stone", "other ecologically valuable landscape elements")

    I would be grateful for a hint how to achieve this.
    Stephan

  • #2
    Code:
    sysuse auto, clear 
    collapse price, by(foreign)
    graph hbar price, over(foreign)  
    gen whatever = 42
    label def whatever 42 "Origin"
    label val whatever whatever
    graph hbar price, over(foreign) over(whatever)

    Comment


    • #3
      Dear Nick, thank you for your suggestion. It works fine with my auto-example but unfortunately is not applicable in my case. My labels are so long that two of them do not fit horizonatlly. I had in mind that the header should not be positioned to the left of the lables but on top of the lables, like an axis title in a twoway plot. But I cannot find an axis title option in graph hbar. do you have a way to achieve that?
      Stephan

      Comment


      • #4
        If your title is really long it might have to be vertical.

        Code:
        sysuse auto, clear 
        collapse price, by(foreign)
        graph hbar price, over(foreign)  
        graph hbar price, over(foreign) l1title(Origin)

        Comment


        • #5
          Dear Nick, this is a good option that works in my case. Thank you! STephan

          Comment

          Working...
          X