Announcement

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

  • Why graph twoway has no format(%fmt) suboption in mlabel

    Dear Stata users,
    I was puzzled by this trivial difference of format(%fmt) suboption between graph twoway and graph bar. In the latter, there's a format(%fmt) suboption in blabel_option. The format(%fmt) specifies the display format to be used to format the height value. On the contrary, there's no format(%fmt) suboption in mlabel_option of graph twoway plots. I know that when we specify marker variables by using mlabel(varlist), the variables can either numeric or string type. As to the string marker variable, there's certainly no need to specifies the display format. However, when we specify a numeric variable as marker label, would't it be more convenient to allow a format(%fmt) suboption?
    Code:
    sysuse auto
    graph twoway connected price weight, sort mlabel(price)
    graph bar price, over(foreign) blabel(bar, format(%9.2f))

  • #2
    There is an option -mlabformat()- for twoway scatter. See

    Code:
    help scatter##marker_label_options

    Comment


    • #3
      Thank you very much Andrew Musau. I searched and find that the mlabformat(%fmtlist) suboption is introduced in Stata 18, and it does not exist in Stata 16. Ok, this finding could be counted as an answer to my question in #1.

      Comment


      • #4
        Even the very smart programmers at StataCorp might find it hard to remember (in this case) why something was coded one way and not another in 2003. That's not meant as a put-down, just a wry comment.

        In using marker labels in twoway, I've previously found -- because of this lack before Stata 18 -- that I had to put a formatted version of a numeric variable into a string variable before I could use marker labels as I wanted. That's one more step.

        In contrast, with e.g. graph bar you can only feed numeric arguments to blabel(), which is sometimes limiting the other way.

        Comment

        Working...
        X