MathGroup Archive 2008

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

Search the Archive

Re: Histogram and BoxWhiskers Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91513] Re: Histogram and BoxWhiskers Plot
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 25 Aug 2008 05:05:02 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g8rfe7$f90$1@smc.vnet.net>

LectorZ wrote:

> This is a rather beginner's question:
> 
> I have already pre-aggregated input data in this form:
> 
> data={{30.5, 20}, {2.6, 120},{4.2, 134},....,{Value, Frequency}}
> 
> that means the first number is a Value and the second - the frequency
> of occurence.
> 
> Q: How can I draw a Histogram and BoxWhiskersPlot?
> 
> I played around and found out that with raw data (=a long list of
> values without frequencies) it works fine but for this 2-dimensional
> list I have problems to draw the graphs.

One possible way is to expand your data in a list that contains for each 
pair as many element of the first entry as indicated by the second 
element of each pair.

   Needs["Histograms`"]
   data = {{30.5, 20}, {2.6, 120}, {4.2, 134}, {5.3, 60}, {15.8, 67}};
   Histogram[Flatten[ConstantArray[#[[1]], #[[2]]] & /@ data]]

Regards,
-- Jean-Marc


  • Prev by Date: Re: Extending running memory of Mathematica
  • Next by Date: Re: four dimensional plot
  • Previous by thread: Histogram and BoxWhiskers Plot
  • Next by thread: Re: Histogram and BoxWhiskers Plot