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 wanted to remove the Ticks in my coding but i can't. Here when i try to remove the Ticks the number also gone. I need numbers without Ticks, Ticks and GridLines should be automatic and don't usePlotRange .

BarChart[{{1, 2, 3}, {4, 5, 6}}, ImageSize -> 400, BarOrigin -> Left, 
          ChartLayout -> "Stacked", ImageSize -> {500, 300}, 
          GridLines -> {Automatic, None}, Ticks -> {{Automatic}, None}
          , 
          LabelStyle -> Directive[Opacity[1]], 
          TicksStyle -> Directive[Opacity[.3]]
          , 
          Axes -> {True, False}, AxesStyle -> Opacity[.0], 
          ChartStyle -> {RGBColor[.06, .29, .66], RGBColor[.01, .56, .61], 
                         RGBColor[1, .58, 0]},
          ChartBaseStyle -> EdgeForm[GrayLevel[.6]]]

enter image description here

share|improve this question
5  
Removing ticks. :o) –  Mr.Wizard Dec 21 '12 at 14:53
1  
@Mr.Wizard cdc.gov/ticks/removing_a_tick.html ...if only the removal of bug were that simple. –  Yves Klett Dec 22 '12 at 9:20
    
niren, please consider Accepting answers to some of your questions. –  Mr.Wizard Dec 30 '12 at 15:27

4 Answers 4

Simply use option:

TicksStyle -> Directive[20, Opacity[0], FontOpacity -> 0.3]

Mathematica graphics

Credit to R.M for showing me FontOpacity.

share|improve this answer

You could specify the Ticks manually, for example by

Ticks -> {Table[{i, i, 0}, {i, 0, 14, 2}], None},

The y axis stays without Ticks by the None the x axis gets at $i=0,2,...,14$ a Tick at $i$ with $i$ as label and zero ticks width.

share|improve this answer
    
No Ticks should be used because when i change value of BarChart the number have to change automatically based on values. –  niren Dec 21 '12 at 12:03
    
You could adapt the Tableto the values the Ticks should be based on. E.g. if you have a min and a max and want to have num values Table[{i,i,0},{i,min,max,(max-min)/num}] –  Ronny Dec 21 '12 at 12:06
    
Though I haven't had the possibility to check that here you may want to look at the CutomTicks package or this TickControl Code library.wolfram.com/infocenter/MathSource/5217 –  Ronny Dec 21 '12 at 12:35

You can keep the numbers as they current show up but remove the ticks by specifying ticks as follows:

Ticks -> {Table[{2 i, 2 i, 0}, {i, 7}], None}

or

Ticks -> {Table[{2 i + 1, 2 i + 1, 0}, {i, 0, 8}], None}

(each tick is specified by a triplet {a,b,c}, with a corresponding to the location on the axis, b the label used, and c the length of the tick used - just set the length equal to 0).

share|improve this answer

Due to AbsoluteOptions reporting Ticks and GridLines in an unuseable fashion, I've had to resort to Rasterizing to find out how many grid lines are automatically being produced.

data = {{1, 2, 3}, {4, 5, 6}};

bc = BarChart[data, ImageSize -> 400, BarOrigin -> Left, 
   ChartLayout -> "Stacked", ImageSize -> {500, 300}, 
   GridLines -> {Automatic, None}, Ticks -> {{Automatic}, None}, 
   LabelStyle -> 
    Directive[Bold, Opacity[1], Thick, Black, 
     FontFamily -> "Helvetica"], 
   TicksStyle -> Directive[20, Opacity[.3]], Axes -> {True, False}, 
   AxesStyle -> Opacity[.0], 
   ChartStyle -> {RGBColor[.06, .29, .66], RGBColor[.01, .56, .61], 
     RGBColor[1, .58, 0]}, ChartBaseStyle -> EdgeForm[GrayLevel[.6]]];

rbc = Rasterize[bc];
lines = Min[Last /@ Tally[rbc[[1, 1, -1]](* Top row of pixels *)]];
max = Max[Total /@ data];
interval = Quotient[max, (lines - 1)];
maxline = (lines - 1)*interval;
ticks = {Table[{i,(* Frame for padding *)Framed[ToString[i],
  FrameStyle -> None], 0}, {i, 0, maxline, interval}], None};

BarChart[data, ImageSize -> 400, BarOrigin -> Left, 
 ChartLayout -> "Stacked", ImageSize -> {500, 300}, 
 GridLines -> {Automatic, None}, Ticks -> ticks, 
 LabelStyle -> 
  Directive[Bold, Opacity[1], Thick, Black, 
   FontFamily -> "Helvetica"], 
 TicksStyle -> Directive[20, Opacity[.3]], Axes -> {True, False}, 
 AxesStyle -> Opacity[.0], 
 ChartStyle -> {RGBColor[.06, .29, .66], RGBColor[.01, .56, .61], 
   RGBColor[1, .58, 0]}, ChartBaseStyle -> EdgeForm[GrayLevel[.6]]]

enter image description here

share|improve this answer

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.