Announcement

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

  • left aligning/adjusting y-labels

    Hi

    I would like to left align or left adjust string y-labels.

    My best shot so far has been:
    Code:
    sysuse auto
    label define rep78 1 "{lalign 20: 1 r}" 2 "{lalign 20: 2 repairs}" 3 "{lalign 20: 3 repairs}" 4 "{lalign 20: 4 repairs}" 5 "{lalign 20: 5 repairs}", replace
    label values rep78 rep78
    twoway (scatter rep78 price), ylabel(, valuelabel angle(0))
    But the aligning isn't right:
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	11.0 KB
ID:	1405370


    Can someone help me?

    Kind regards

    nhb

  • #2
    Been working further with this.

    Inspired by Michael Norman Mitchell I've tried using monospaced fonts:
    Code:
    sysuse auto
    label define rep78 1 "{lalign 20: {fontface courier:1 r      }}" 2 "{lalign 20: {fontface courier:2 repairs}}" 3 "{lalign 20: {fontface courier:3 repairs}}" 4 "{lalign 20: {fontface courier:4 repairs}}" 5 "{lalign 20: {fontface courier:5 repairs}}", replace
    label values rep78 rep78
    twoway (scatter rep78 price), ylabel(, valuelabel angle(0))
    Note that I have to add spaces to give all the label text the same length!!
    This is very inconvenient.

    One can get a list of possible monospaced fonts here

    So not pretty, but a workaround

    Btw the graph now looks like:
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	10.6 KB
ID:	1405474
    Kind regards

    nhb

    Comment


    • #3
      This will I think indeed be difficult unless you use monospaced fonts, which look ugly to me in graphs.

      Not what you're asking, but left-aligned labels come automatically with ysc(alt) -- but on the right-hand side.

      Comment


      • #4
        Hi Nick
        I usually agree regarding monospaced fonts.
        But I found lucida console which is not that bad
        Kind regards

        nhb

        Comment

        Working...
        X