Re: Frame on Bar Chart
- To: mathgroup at smc.vnet.net
- Subject: [mg29604] Re: [mg29584] Frame on Bar Chart
- From: "Philip M. Howe" <pmhowe at lanl.gov>
- Date: Thu, 28 Jun 2001 05:27:56 -0400 (EDT)
- References: <200106270912.FAA04002@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
>Dear Mathgroup, > >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. > >Thanks in advance > >Hugh Goyder Hello Hugh, Histogram should help you with this problem: << Graphics`Graphics` 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}; Histogram[data]; Histogram[data, HistogramCategories -> {0, 5, 10, 15, 20, 25, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95}, Frame -> True]; Regards, Phil -- Philip M. Howe Program Manager, Stockpile Surety Los Alamos National Laboratory (505) 665-5332 (505) 667-9498 Fax: 505-665-5249 email pmhowe at lanl.gov Mail Stop F606
- References:
- Frame on Bar Chart
- From: Hugh Goyder <goyder@rmcs.cranfield.ac.uk>
- Frame on Bar Chart