Solved

Using mathematica how do I plot histogram with data grouped by month (or week)?

Posted on 2011-09-23
2
776 Views
Last Modified: 2012-05-12
I am test driving Mathematica and I am stuck on trying to figure how to plot a histogram where the data is grouped by weekly or monthly dates.

Using:
ClosedPos1 = {#[[1, 1]], #[[2]]} & /@ SQLExecute[conn, "
   SELECT pDate, NumClosePos FROM stats__s1_c_long_tft3
   WHERE NumClosePos > 1
   "]

I have extraced from MySQL Database a list of dates, and a value. The list spans 2+ years and consist of daily dates.

I want to plot a histogram showing me the total  number of values which exist for each month. I then want to plot the same but using the total count for each week.

Here is a sample of the data:

{{{2009, 8, 19}, 2}, {{2009, 8, 20}, 4}, {{2009, 8, 21},
  4}, {{2009, 8, 24}, 3}, {{2009, 9, 3}, 4}, {{2009, 9, 8},
  2}, {{2009, 9, 9}, 5}, {{2009, 9, 10}, 5}, {{2009, 9, 17},
  2}, {{2009, 9, 18}, 2}, {{2009, 9, 21}, 2}, {{2009, 9, 28},
  5}, {{2009, 10, 2}, 2}, {{2009, 10, 12}, 5}, {{2009, 10, 21},
  2}, {{2009, 10, 23}, 3}, {{2009, 10, 28}, 4}, {{2009, 10, 30},
  5}, {{2009, 11, 2}, 5}, {{2009, 11, 5}, 4}, {{2009, 11, 9},
  3}, {{2009, 11, 16}, 6}, {{2009, 11, 18}, 4}, {{2009, 11, 30},
  2}, {{2009, 12, 1}, 13}, {{2009, 12, 2}, 3}, {{2009, 12, 3},
  2}, {{2009, 12, 10}, 3}, {{2009, 12, 14}, 6}, {{2009, 12, 16},
  4}, {{2009, 12, 17}, 2}, {{2009, 12, 18}, 7},
.......,

So, if I was summing weekly data the first plot would span
{2009, 8, 19}, 2}, {{2009, 8, 20}, 4}, {{2009, 8, 21}, 4},
which would be 2+4+4 = 10, and so on

If I was plotting monthly the each bar in the histogram would be the sum of the values for that month.

I would like to use FrameLabel to name the axis.

I have just spent 2 hours googling for some sample code but no luck.

Any help is appreciated!
0
Comment
Question by:John_2357
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
karunamoorthy earned 500 total points
ID: 36938991
you want to get any code i.e. sql query so that it will give you values for weekwise/yearwise counts or
code for creating histogram in excel spread sheet.

What you want is matters here. Could you brief here what really you are looking for

0
 
LVL 1

Author Closing Comment

by:John_2357
ID: 37047697
b
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
We are taking giant steps in technological advances in the field of wireless telephony. At just 10 years since the advent of smartphones, it is crucial to examine the benefits and disadvantages that have been report to us.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question