Announcement

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

  • Limiting tlabel/ttick ranges: no max value

    Good Morning Statalisters,

    Long-time user/reader here posting for the first time. I apologize if I violate any rules in advance, but I'm unsure if this would be a test post or not...

    I'm working to display tsline graphics with automated updates from given data. Specifically, I'm interested in limiting my tlabel/ttick ranges without specifying a max date. Here is a sample of my code:



    twoway tsline ... .... if datevar > tm(2004m1), tlabel(2004m1 (12) ., format(%tmYY)) ttick(2004m1 (12) .) ... ...



    I'm unable to search and find a means to not limit based upon my pre-specified information, rather, I'd like to limit the label/tick ranges to the max of the dataset.

    I greatly appreciate the help in advance! I see myself as a budding Stata user.

    Kind Regards,

    Ryan Daly

  • #2
    There is a rule minmax that you can specify to any axis label option. Is that what you want? Stata's defaults tend to be fairly sensible here.

    Comment


    • #3
      Thanks for the reply. I saw the minmax, but wasn't sure if I can limit it strictly to the max only, as I want a hard limit on the minimum.

      In place of the upper limit, I attempted to use (.) for "none/skip the rule", but it doesn't appear to work unless my syntax is incorrect above. "ttick(2004m1 (12) .). Also, leaving it blank errors as well.

      P.S. attempting a "ttick(2004m1 (12) minmax)" errors as well. minmax appears to be a hard command, describing a return of both min and max values, rather than an both/either/or.
      Last edited by Ryan Daly; 24 Mar 2015, 08:55.

      Comment


      • #4
        You can wire in a minimum by giving the numerical value of that minimum, You can be empirical about a maximum by issuing summarize, meanonly before the graph call and use its r(max). What's hard is to combine that with any other rule and get nice results. In the experiments I tried, the label for the maximum all too often overlapped with the label to its left.

        Is the question morphing into one about ticks? Nice labels is the hard part; two ticks close to each other is less worrying to me and perhaps others.

        Comment


        • #5
          Thanks Nick for the feedback. It isn't specifically about the ticks, but labels as well. I have forecasts that will continually update, but keeping the minimum date fixed addresses too much information being displayed in the graphics. Having recent or forward dates "floating" seems appropriate for these reports.

          For now, I'm able to hard code a global macro value for the date in question and using that as the value for all graphics. I just need to remember to update as time passes within the reporting.

          Comment

          Working...
          X