Announcement

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

  • -mylabels- updated on SSC

    Thanks to Kit Baum as usual, mylabels has been updated on SSC.

    mylabels and its sibling myticks generate axis labels and ticks on specified scales.

    The update follows a recent thread

    http://www.statalist.org/forums/foru...trailing-zeros

    in which a user wanted both leading zeros and a "clean" format without trailing zeros.

    The new option clean specifies a minimal format eliding trailing zeros and decimal points (whether periods (stops) or commas). This option is most often used together with format(). Thus by itself format(%03.2f) would render 0(0.25)1 as 0.00 0.25 0.50 0.75 1.00 but clean reduces it to 0 0.25 0.5 0.75 1. The help gives more details.

    A perhaps bigger deal is that the code and help file have been rewritten. The syntax and examples should, I hope, now seem clearer.

    Stata 8 is required. To install or update use ssc or adoupdate.

  • #2
    Could you please show us exactly how to combine format with clean? I have tried the below without any success:

    format(%6.2f) clean
    format(%6.2f, clean)

    The full code for what I am trying to do is (in the context of plotting a graph of the underlying raw data) (in Stata/SE 14.2):

    program define lojack
    args y ylabel title1 ytitle1 filename

    twoway scatter `y' ydiff if ydiff >=-8 & ydiff<=8 & state == "GA", connect(l) msize(*1.2) clwidth(*2) ylabel(`ylabel',format(%6.2f)) xlabel(-8(2)8) /*
    */ saving(`filename', replace) title("`title1'", size(*1.0)) xtitle("Years since the adoption of withholding for the personal income tax", size(*1.2)) ytitle("`ytitle1'")

    end

    lojack arciiba "25 (25) 150" "State personal income tax revenues" "Real per capita income tax revenue" w2lj_rcii

    The reason for trying to use clean is to have the zero before a decimal point but not have the trailing zeros. Thus, having 25 and 0.50 rather than 25.00 and 0.50 or 25 and .5.
    Thank you,
    Sutirtha

    Comment


    • #3
      Sorry, but I don't follow what you're asking.

      You don't give a data example but your example program is being fed 25(25)150 to use as y axis labels. twoway will be totally happy with that and you don't need mylabels at all.

      That aside, clean is not a suboption, but a separate option, in the syntax, as the help explains. This example is copied from the help:

      Code:
      . mylabels 0.005(0.005)0.025, format(%04.3f) clean local(labels)
      .005 "0.005" .01 "0.01" .015 "0.015" .02 "0.02" .025 "0.025"

      Comment

      Working...
      X