Re: BarChart inside a Frame. How to remove Labels from the top of the frame? How to put x-axis label below and not on the side?
- To: mathgroup at smc.vnet.net
- Subject: [mg80635] Re: [mg80589] BarChart inside a Frame. How to remove Labels from the top of the frame? How to put x-axis label below and not on the side?
- From: "Nasser Abbasi" <nma at 12000.org>
- Date: Sun, 26 Aug 2007 23:29:13 -0400 (EDT)
- References: <7450967.1188123489454.JavaMail.root@eastrmwml24.mgt.cox.net>
- Reply-to: "Nasser Abbasi" <nma at 12000.org>
> ---- Nasser Abbasi <nma at 12000.org> wrote:
>> Mathematica 6.0.1
>>
>> This is really annoying. I wanted a BarChart inside a frame. All works
>> ok,
>> except it insists on putting the bar labels on top of the frame as well
>> as
>> on the bottom of the frame, like this:
>>
>> BarChart[{1, 2, 3}, Frame -> True]
>>
>> I can remove the labels altogether, and use FrameTicks, but it still does
>> it
>> again !
>>
>> BarChart[{1, 2, 3}, Frame ->
>> True,BarLabels->None,FrameTicks->{{1,2,3},{0,1}}]
>>
>> I think BarChart conflict with Frame somehow.
>>
>> The only reason I wanted to put the BarChart inside a frame, is that with
>> a
>> frame, when I put the x-label, it will go below and not on the side.
>>
>> I wanted to write a large x-label, and just using BarChart, the x-label
>> was
>> extending too far to the right since it start at the right edge of the
>> axis,
>> as you see from this example
>>
>> BarChart[{1, 2, 3}, AxesLabel -> {"x-axis label"}]
>>
>> Is there a way to solve this problem? Either just use BarChart without
>> Frame, but tell it to put the x-label BELOW, or use a Frame with BarChart
>> but not have the bar labels at top and bottom as well?
>>
> Needs["BarCharts`"];
>
> BarChart[{1, 2, 3},
> Frame -> True, FrameTicks -> {Range[3], Range[0, 3], None, None},
> FrameLabel -> (Style[#, FontSize -> 14] & /@ {"x-axis label",
> "y-axis label"})]
>
> BarChart[{1, 2, 3},
> Frame -> {True, True, None, None},
> FrameTicks -> {Range[3], Range[0, 3], None, None},
> FrameLabel -> (Style[#, FontSize -> 14] & /@ {"x-axis label",
> "y-axis label"})]
>
>
> Bob Hanlon
>
Thanks Bob,
You solution helps, but now I am unable now to use BarLabels !
I can't use FrameTicks in place of BarLabels, since FrameTicks do not get
positioned at the same locations as BarLabels. Using Frame seems to prevent
BarLabels from showing up:
BarChart[{1, 2, 3}, Frame -> True, BarLabels -> {0, 1, 2},
FrameTicks -> {None, Range[0, 3], None, None},
FrameLabel -> (Style[#1, FontSize -> 14] & ) /@ {"x-axis label", "y-axis
label"}]
For example, If I replace frameTicks for the x-axis with what I wanted to be
the BarLabels, I get this
BarChart[{1, 2, 3}, Frame -> True, FrameTicks -> {{0, 1, 2}, Range[0, 3],
None, None},
FrameLabel -> (Style[#1, FontSize -> 14] & ) /@ {"x-axis label", "y-axis
label"}]
and nothing I did would make FrameTicks {0,1,2} to be placed right where the
earlier frameTicks {1,2,3} were.
ofcourse I can use BarLabels without the FrameTicks, but then we are back to
square one, the BarLabels would now show in the top and bottom:
BarChart[{1, 2, 3}, Frame -> True, BarLabels -> {0, 1, 2},
FrameLabel -> (Style[#1, FontSize -> 14] & ) /@ {"x-axis label", "y-axis
label"}]
Nasser