Re: How to display dates in plots
- To: mathgroup at smc.vnet.net
- Subject: [mg58727] Re: How to display dates in plots
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 15 Jul 2005 14:14:09 -0400 (EDT)
- References: <db7nt2$mss$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
ggroup at sarj.ca schrieb: > I'm evaluating Mathematica v5.1 to automate some data analysis for me. > I have one question that I have yet to find an answer (or even a clue). > I was hoping someone here may have a good idea. > > I collect data sets that I want to plot in various ways versus time. > Each record in the data sets includes a date/time string and various > (numeric) sensor readings. I've got an ugly but effective loop to > convert the date strings in my data files to serial time. I've been > this serial time to plot my data. Now the question is: is there a way > to format the plot axes to display a human readable date rather than > the serial date? > > One note: Not all the data records are taken at regular intervals. > When an event is happening on one of the sensors, we often increase the > sampling frequency to get better resolution. > > Thanks very much. > {start, stop} = FromDate /@ {{2005, 6, 15, 13, 0, 0}, {2005, 7, 24, 17, 4, 0}}; As example: a 'weekly' sine wave Plot[Sin[t*(2*Pi/(24*3600*7))], {t, start, stop}, Ticks -> {Table[{i, StringForm["`1`/`2`", ##1]& @@ Take[ToDate[i], {2, 3}]}, {i, start, stop, 2*24*3600}], Automatic}, AspectRatio -> 1/8, ImageSize -> 800]; This will place tickmarks every two days and print them as month/day. -- Peter Pein Berlin http://people.freenet.de/Peter_Berlin/