Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Maria Ana Vitorino <vitorino@wharton.upenn.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: number of dates in x axis |

Date |
Tue, 24 May 2011 14:11:07 -0400 |

Thanks for the help! Ana On May 24, 2011, at 1:31 PM, Nick Cox wrote:

Yes. Show me the _exact_ code you typed. Nick n.j.cox@durham.ac.uk -----Original Message-----From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maria Ana VitorinoSent: 24 May 2011 18:29 To: statalist@hsphsun2.harvard.edu Subject: Re: st: number of dates in x axis Thanks Nick. I tried running your example but I got the error message "invalid label specifier, : 15341 15400 15461 ..." Any suggestions? Thanks! Ana On May 24, 2011, at 4:20 AM, Nick Cox wrote:There is relevant material at Stata 7: How can I get "nice" date labels on a graph? http://www.stata.com/support/faqs/graphics/nicedate.html StataCorp have added this annotation: "Note: This FAQ is relevant for users of releases prior to Stata 8. For Stata 8 see update from 12 September 2003." In fact the techniques there do remain useful for some problems. Here's an example with different data. Here I decide that I want labels every 2 months from 1 January 2002 to 1 January 2003. I loop over the dates and put them in a bag, namely a local macro. sysuse xtline1 xtset person day forval i = 1(2)11 { local thisdate = mdy(`i', 1, 2002) local mydates `mydates' `thisdate' } local thisdate = mdy(1,1,2003) local mydates `mydates' `thisdate' xtline calories, overlay xlabel(`mydates', format(%d_m_Y) ang(v)) See also SJ-7-4 gr0030 . Stata tip 55: Better axis labeling for time points/ intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/07 SJ 7(4):590--592 (no commands) tip on labeling graphs for time points and time intervals On Tue, May 24, 2011 at 4:45 AM, Maria Ana Vitorino <vitorino@wharton.upenn.edu> wrote:I have the following data: +------------------------+ | Person Weight Date | |------------------------| 1. | Name1 50 17988 | 2. | Name1 55 18110 | 3. | Name1 50 18141 | 4. | Name1 45 18171 | 5. | ... . . | |------------------------| 6. | Name2 85 18110 | 7. | Name2 88 18171 | 8. | Name3 68 17988 | 9. | ... . . | 10. | .. . . | |------------------------| 11. | NameN . . | +------------------------+ The labels for the date variables are the months' names (plus year) (e.g. "jan2006", "feb2007", etc) If I do something like: xtline Weight , overlay i(Person) t(Date) xlab(, valuelabel) The month names show up on the xaxis BUT only every 6 months or so. How can I control the number of "ticks" (AND month names ) that show up on the x-axis? (suppose I want a tick every 2 months or even every month)* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: number of dates in x axis***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: number of dates in x axis***From:*Maria Ana Vitorino <vitorino@wharton.upenn.edu>

**Re: st: number of dates in x axis***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: number of dates in x axis***From:*Maria Ana Vitorino <vitorino@wharton.upenn.edu>

**RE: st: number of dates in x axis***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**RE: st: Right to Left Column Cascade or Adjustment** - Next by Date:
**RE: st: number of dates in x axis** - Previous by thread:
**RE: st: number of dates in x axis** - Next by thread:
**RE: st: number of dates in x axis** - Index(es):