Re: date/time ListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg21022] Re: [mg20979] date/time ListPlot
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Thu, 2 Dec 1999 21:41:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
magni [magni at omega.ien.it] wrote: > I am badly in need to create a plot of points > > in which the abscissa is a date - they span some years, > > so at least I need ticks like "Jan-99" or similar. > > I absolutely didn't find anything on this subject, > > in the newsgroup nor on Wolfram site, nor on The Book. > > The only exception is the package of Nigel King, that > > I cannot find a way to let it work. > > Since it seems to me a rather basic plotting usage, > > is it possible there isnt anything on this subject? Suppose you have a list of 12 values, say, val, which you would like to plot. Define first the list of names you wish to have for your ticks, one for each point along the horizontal axis. For example, last day of each month in a year: In[1]:= ticshor = { "31 Jan", "28 Feb", "31 Mar", "30 Apr", "31 May", "30 Jun", "31 Jul", "31 Aug", "30 Sep", "31 Oct", "30 Nov", "31 Dec"}; Then, make the list In[2]:= nomes = Transpose[{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, ticshor}] Out[93]= {{1, "31 Jan"}, {2, "28 Feb"}, {3, "31 Mar"}, {4, "30 Apr"}, {5, "31 May"}, {6, "30 Jun"}, {7, "31 Jul"}, {8, "31 Aug"}, {9, "30 Sep"}, {10, "31 Oct"}, {11, "30 Nov"}, {12, "31 Dec"}} and do your plot with options as below: In[3]:= ListPlot[val, Frame -> True, FrameTicks -> nomes] See options for Graphics objects in The Book, 2.9.1. Tomas Garza Mexico City