Announcement

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

  • The label is too long to fit on the X axis.

    Hi I'm stata beginner.

    I 'm drawing graph, but label is too long to fit on the X axis.

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	15.7 KB
ID:	1508660


    Is there any way to distinguish label name on the graph???
    (By writing vertically or by tilting the label )


    label define gr 1 "<18.5" 2 "18.5-19.5" 3 "19.5-20.5" 4 "20.5-21.5" 5 "21.5-22.5" 6 "22.5-23.5" 7 "23.5-24.5" 8 "24.5-25.5" 9 "25.5-26.5" 10 "26.5-27.5" 11 "27.5-28.5" 12 "28.5-29.5" 13 "29.5-30.5" 14 "30.5-31.5" 15 "31.5-32.5" 16 "32.5-33.5" 17 "33.5-34.5" 18 ">34.5"
    label values gr gr

    fvset b 9 gr
    logistic outcome i.gr sbp dbp
    est store uni
    coefplot uni , vertical keep(*.gr) eform baselevel leg(off) ysize(1.8) xsize (2.5) yline(1) msymbol(S) pstyle(p1)




  • #2
    -coefplot- is a user written command, and it is not one that I use. But on the assumption that it passes through all -graph twoway- options, try adding -xlabel(angle 45)- for oblique printing, or -xlabel(angle 90)- for vertical printing.

    Another approach is to alternate the labels on two levels using the -xlabel(alternate)- option.

    Comment


    • #3
      I would switch the axes, it makes the graph more readable.

      Code:
      coefplot uni , horizontal  ylab(,angle(0)) ...

      Comment


      • #4
        Thank you Clyde and Andrew.

        I didn't know about ,angle option.

        And switching axis also nice option for visualization.

        Thank you for let me use axis and label option more flexibly

        Comment


        • #5
          The bins in #1 are ambiguous: which way would e.g. 19.5 jump? That may not matter if only integers occur. I would recommend at most labels like 19 20 21 .... and a longer explanation in the caption or text.

          Comment


          • #6
            Thank you Nick.

            I used 18.5 because it defines underweight cut-off level in BMI category , but all other cut off values are integers so Using integer cutoff value or longer explanation also good way.

            I saw you many other post, so I feel honored.

            Thank you.

            Comment

            Working...
            X