6
$\begingroup$

Given the following chart:

BarChart[{{1, 2, 3}, {4, 5, 6}}, ChartLabels -> {{"r1", "r2"}, None}]

How can I remove the ticks of the chart labels (marked with red circles)?enter image description here

$\endgroup$
  • 4
    $\begingroup$ You can add the options TicksStyle -> Opacity@0, LabelStyle -> Opacity@1 to make the ticks transparent, while keeping the labels visible $\endgroup$ – Lukas Lang Aug 6 at 15:54
6
$\begingroup$

You can post-process to remove the tick lines on the horizontal axis:

bc = BarChart[{{1, 2, 3}, {4, 5, 6}}, ChartLabels -> {{"r1", "r2"}, None}];
DeleteCases[bc, _Line?(Not@*FreeQ[_Offset]), All]

enter image description here

Note: Although the default settings for the horizontal axis are False for Axes and {} for Ticks,

Options[bc, Axes]

{Axes -> {False, True}}

Ticks /. AbsoluteOptions[bc, Ticks]// First

{}

Lukas's suggestion TicksStyle -> {Opacity@0, Automatic} and LabelStyle -> Opacity[1] also works.

$\endgroup$
  • $\begingroup$ That works well, thank you both for the help! $\endgroup$ – holistic Aug 7 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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