Re: NEWBIE QUESTION - How to create a barchart with two data sets.
- To: mathgroup at smc.vnet.net
- Subject: [mg95320] Re: NEWBIE QUESTION - How to create a barchart with two data sets.
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 15 Jan 2009 06:12:26 -0500 (EST)
On 1/14/09 at 5:33 AM, tim at usrbs.com (Tim Heger) wrote: >I am new to Mathematica and can't seem to figure out how to do a >simple bar chart using 2 data sets, in Excel you either have the >data in a series in rows or columns. Using version 7 of Mathematica, first generate two data sets by doing something like: dataSet1 = RandomReal[NormalDistribution[5, 1], 100]; dataSet2 = RandomReal[NormalDistribution[7, 1], 100]; then the bar chart (which I interpret to be a histogram) can be done as: Histogram[{dataSet1, dataSet2}] And if you truly do want bar charts rather than a histogram, simply replace Histogram with BarChart. Of course with random data as I've generated above, the plot produced by BarChart is meaningless. With either BarChart or Histogram, there are a variety of options available for controlling the appearance of the plot. See the documentation for details.