MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Graph by Date

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93212] Graph by Date
  • From: "Charles L. Snyder" <clsnyder at gmail.com>
  • Date: Fri, 31 Oct 2008 03:06:34 -0500 (EST)

Hi

Although I've searched the Mathematica documentation and this
newsgroup's files, I am having trouble producing a Plot by Month -
specifically a graph by month on the x-axis, and a total of the values
in column 3 for that month: eg.,

mydata = {{1/5/2004, "widgetA", 55.2},{1/15/2004, "widgetD32", 5.2},
{2/7/2004, "no_Widgets", 34.5},{5/6/2004, "widget62", 100.2},
{5/16/2004, "widget6", 30.5},{9/13/2004, "widget 55t", 225.79}}

result would be  a graph of
Jan 2004 57.4   (55.2+5.2)
Feb 2004 34.2
Mar 2004 0
April 2004 0
May 2004  130.7 (100.2 + 30.5)
June 2004 0
July 2004 0
Aug 2004 0
Sep 2004 225.79
all other months 0

I did find a way to summarize the dates and plot it:

data = #[[1]] & /@ mydata;
cs = Tally[Sort[data]];

DateListPlot[cs, Filling -> Bottom,
 FillingStyle -> Blue, PlotStyle -> {Red, PointSize[Large]},
 PlotRange -> {{{2004, 1}, {2004, 12}}, Automatic},
 DateTicksFormat -> {"Month", "/", "YearShort"}]

Even this gives me the error messages for the dates such as -
DateList::ambig: "Warning: the interpretation of the string \
\!\(\"10/1/2004\"\) as a date is ambiguous"

Thanks again

clsnyder


  • Prev by Date: Re: eps and pdf export of Graphic3D
  • Next by Date: Re: Re: Hypergeometric2F1
  • Previous by thread: Frustration with opaque functions in Mathematica
  • Next by thread: Design by Contracts in Mathematica