Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Bar chart style with ListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110471] Re: Bar chart style with ListPlot
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 20 Jun 2010 03:44:32 -0400 (EDT)

On 6/19/10 at 7:46 AM, mikeg at utk.edu (Michael A. Gilchrist) wrote:

>I'm working with some discrete probability functions and plotting
>them using ListPlot.  Given the nature of the function, I believe
>its clearest to represent the values using bars rather than
>points. I know there's a BarChart function, but it isn't as
>easy to use
>(e.g. you can't just give it a list of x, y coordinates and you
>can't easily have overlaying datasets, they sit next to each other).

>I'm wondering if anyone else has run into this problem and/or has
>any suggestions on how to solve it.  For example, are there options
>I can set that will give me the desired behavior?

Instead of BarChart, I would use either DiscretePlot (when the
distribution can be specified as a function) or ListPlot. For
example, with DiscretePlot

DiscretePlot[{PDF[BinomialDistribution[50, .8], k],
   PDF[BinomialDistribution[50, .3], k]}, {k, 0, 50}, Frame -> True]

or with ListPlot

ListPlot[{Table[PDF[BinomialDistribution[50, .8], k], {k, 0, 50}],
   Table[PDF[BinomialDistribution[50, .3], k], {k, 0, 50}]},
  PlotStyle -> PointSize[.015], Filling -> Axis,
  FillingStyle -> Thickness[.002], Frame -> True]



  • Prev by Date: Re: Book?
  • Next by Date: Re: Why?
  • Previous by thread: Re: Bar chart style with ListPlot
  • Next by thread: Re: Bar chart style with ListPlot