MathGroup Archive 2008

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

Search the Archive

Re: Graph by Date

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93262] Re: Graph by Date
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 1 Nov 2008 05:11:21 -0500 (EST)

On 10/31/08 at 3:06 AM, clsnyder at gmail.com (Charles L. Snyder) wrote:

>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}}

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

>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"

You really haven't asked a question here. I will assume your
concern is the warning message. There are several possibilities including:

ignore it: all that it is telling you is 1/5/2004 could be seen
as Jan 5, 2004 or May 1, 3004. If you get the result you want
there is no reason to do anything but ignore it.

suppress the message: that can be done by using Quiet. That is

Quiet@DateListPlot[cs, ...

will create the same plot without generating a warning message

resolve the ambiguity: This can be done by specifying the date
format. For example,

DateListPlot[mydata[[All, ;; ;; 2]],
  DateFunction :> (DateList[{#, {"Month", "/", "Day", "/",
        "YearShort"}}] &), Filling -> Bottom, FillingStyle -> Blue,
  PlotStyle -> {Red, PointSize[Large]},
  PlotRange -> {{{2004, 1}, {2004, 12}}, All},
  DateTicksFormat -> {"Month", "/", "YearShort"}]

re-direct it: Perhaps the only issue is you are preparing a
report and don't want the warning message to appear in the
notebook where the plot is being generated. Then go to the
Evaluation tab of the preferences dialog and make the
appropriate selection.


  • Prev by Date: Re: Graph by Date
  • Next by Date: Re: PDE heat equation (inconsisten problem)
  • Previous by thread: Re: Graph by Date
  • Next by thread: Re: Graph by Date