Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have created a bar chart with the below code. My $x$ axis labels have been cut in half for some reason. My $x$ axis heading is also missing. I tried using Placed -> Below instead of Placed -> Axis as proposed in an answer to a similar question about labels bieng cut in half but this does not seem to work at all with my version (Mathematica 9). When I resize the chart the axis labels eventually stop bieng cut in half when the chart is huge but my main $x$ axis heading is still missing. I can't use Labeled [{xheading,yheading}, {position,position}] becasue it is not a graphics object and I need my bar chart to be a graphics object so I can use it in Show later.

data = {{71.74887892, 75.81967213}, {75.81120944, 77.88018433},
        {0.6600660066, 1.673640167}, {84.74576271, 79.34782609},
        {76.4, 79.49790795}, {78.84267631, 80.11782032},
        {71.51515152, 74.30249633}, {85.57692308, 79.37062937},
        {71.875, 74.3772242}, {66.28477905, 64.25233645},
        {1.490066225, 1.914414414}, {1.474926254, 1.763224181}};
dataLabel = {"DT401       ", "DT402       ", "DT403       ", "DT404       ", 
             "DT405       ", "DT406       ", "DT407       ", "DT408       ", 
             "DT409       ", "DT410       ", "DT411       ", "DT412       "};
label = "Truck";

BarChart[data, PlotRange -> {{0, 25}, {0, 100}}, 
 ChartLabels -> {Placed[l, Axis], Placed[{"", ""}, Bottom]}, 
 PlotLabel -> label, 
 AxesLabel -> {label, label}]

enter image description here

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Use ImagePadding -> {{left, right}, {bottom, top}}:

BarChart[data, PlotRange -> {{0, 25}, {0, 100}}, 
 ChartLabels -> {Placed[l, Axis], Placed[{"", ""}, Bottom]}, 
 PlotLabel -> label, AxesLabel -> {label, label}, ImagePadding -> {{10, 40}, {20, 20}}]

enter image description here

share|improve this answer
    
+1 for the right answer and the efficient edit of the question –  cormullion Apr 11 '13 at 15:05
    
Thanks @cormullion. I just get this itch to edit when I see a post that is not stripped to the obvious sufficient minimum. –  István Zachar Apr 11 '13 at 15:11
add comment

Try tweaking the PlotRange:

 BarChart[{{71.74887892, 75.81967213}, {75.81120944, 
   77.88018433}, {0.6600660066, 1.673640167}, {84.74576271, 
   79.34782609}, {76.4, 79.49790795}, {78.84267631, 
   80.11782032}, {71.51515152, 74.30249633}, {85.57692308, 
   79.37062937}, {71.875, 74.3772242}, {66.28477905, 
   64.25233645}, {1.490066225, 1.914414414}, {1.474926254, 
   1.763224181}},
 PlotRange -> {{0, 25}, {-5, 100}},
 ChartLabels -> {Placed[
    StringTrim[{"DT401       ", "DT402       ", "DT403       ", 
      "DT404       ", "DT405       ", "DT406       ", "DT407       ", 
      "DT408       ", "DT409       ", "DT410       ", "DT411       ", 
      "DT412       "}
     ], Axis], Placed[{"", ""}, Bottom]}]

barchart

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.