MathGroup Archive 2008

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

Search the Archive

Re: Histogram and BoxWhiskers Plot

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.

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

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