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

MathGroup Archive 2009

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

Search the Archive

Re: Re: Precise control of horizontal ticks with BarChart?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104643] Re: [mg104598] Re: Precise control of horizontal ticks with BarChart?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 5 Nov 2009 03:53:12 -0500 (EST)
  • References: <200911040640.BAA08956@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

(First a lollipop remake of Bill's solution.)

data = Tally[RandomInteger[{1, 10}, 100]];

ListPlot[data,
  Epilog -> {Blue, Thickness[.02],
    Line[data /. {a_, b_} :> {{a, 0}, {a, b}}]}, Frame -> True,
  PlotRange -> {-.5, 20}, Axes -> None,
  PlotStyle -> {PointSize[0.1], Red}]

and a solution of my own:

{xMin, yMin} = Min /@ Transpose@data;
{xMax, yMax} = Max /@ Transpose@data;
Graphics[{EdgeForm@{Thick, Black}, Blue,
   Table[Rectangle[pair {1, 0}, pair + {1/2, 0}], {pair, data}]},
  AspectRatio -> 1/GoldenRatio, Frame -> True]

Bobby

On Wed, 04 Nov 2009 00:40:00 -0600, Bill Rowe <readnews at sbcglobal.net>  
wrote:

> On 11/3/09 at 2:54 AM, szhorvat at gmail.com (Szabolcs Horv=C3=A1t) wrote:
>
>> I would like to create a histogram-like plot.  I already have the
>> frequency data, so I don't need to use the Histogram function
>> itself.
>
>> What is the easiest way to do this?
>
> Here is one way that seems simple to me.
>
> data = Tally[RandomInteger[{1, 10}, 100]];
>
> ListPlot[data,
>  Epilog -> {Blue, Thickness[.05],
>    Line[data /. {a_, b_} :> {{a, 0}, {a, b}}]}, Frame -> True,
>  PlotRange -> {-.5, 20}, Axes -> None]
>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Bug with Sequence
  • Next by Date: remote kernel trouble
  • Previous by thread: Re: Precise control of horizontal ticks with BarChart?
  • Next by thread: Re: Problem Replacing part of NonCommutativeMultiply