Re: Frame on Bar Chart
- To: mathgroup at smc.vnet.net
- Subject: [mg29621] Re: [mg29584] Frame on Bar Chart
- From: BobHanlon at aol.com
- Date: Fri, 29 Jun 2001 01:35:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/6/27 5:54:09 AM, goyder at rmcs.cranfield.ac.uk writes: >I wish to plot my students exam results on a bar chart. > >I am fussy and think a frame around the plot looks more professional than >two individual axes and it also enables me to have centred frame labels. > >I have thus tried the following > >In[1]:= >data = >{60,82,81,64,40,48,52,91,57,44,64,41,53,49,37,66,55,76,69,57,48,46,61,67,66, >43,86,74,73,56,77,66,81,72,55,45,71,59,45,68,72,64,90,71,76,71,65,82,76,67,18 , >70,60,88,57,87,93}; > >In[2]:= ><< "Statistics`DescriptiveStatistics`" > >In[3]:= ><< "Graphics`Graphics`" > >In[4]:= >dx = 4; >freq = BinCounts[data, {0, 100, dx}]; >midpoints = Table[i, {i, 0, 100 - dx, dx}]; > >In[7]:= >a = BarChart[Transpose[{freq, midpoints}], Frame -> True, Axes -> False, > > PlotRange -> {All, {-0.5, 10}}, FrameLabel -> {"Marks (%)", "Number >of >Candidates"}]; > >In[10]:= >a = BarChart[Transpose[{freq, midpoints}], Frame -> True, Axes -> False, > > FrameTicks -> {True, True, False, False}, PlotRange -> {All, {-0.5, >10}}, > FrameLabel -> {"Marks (%)", "Number of Candidates"}]; > >The first bar chart puts numbers along the top of the frame which I do >not >want. To get rid of this I tried the second set of options. This looses >the >midpoint values and plots against point number instead. > >I could get the ticks from AbsoluteOptions applied to the first plot and >put them into the second but I feel that there should be a less roundabout >method. > GeneralizedBarChart[ Transpose[{midpoints, freq, Table[dx - .7, {Length[freq]}]}], Frame -> True, Axes -> False, PlotRange -> {All, {-0.5, 10}}, FrameLabel -> {"Marks (%)", "Number of Candidates"}]; Bob Hanlon Chantilly, VA USA