Skip to main content
code formatting fixed
Source Link
Verbeia
  • 34.5k
  • 10
  • 110
  • 225

Personally I prefer Brett's solution, but I wanted to show a few alternative ways to move the chart labels vertically so they are away from each other.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
  ChartLabels -> {Placed[datalist[[All, 1]], Above], None}]

ChartLabels -> {Placed[datalist[[All, 1]], Above], None}]

enter image description here

This version works much better if the labels are regularly spaced numbers. I prefer AdjustmentBox to Column because it allows more control.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    DisplayForm@AdjustmentBox[#, BoxBaselineShift -> 2 Mod[#, 3]] &], 
   None}]

enter image description here

Depending on your operating system and font, you can get some help from the FontTracking option:

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    Style[#, FontTracking -> "Narrow"] &], None}]

enter image description here

Personally I prefer Brett's solution, but I wanted to show a few alternative ways to move the chart labels vertically so they are away from each other.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 

ChartLabels -> {Placed[datalist[[All, 1]], Above], None}]

enter image description here

This version works much better if the labels are regularly spaced numbers. I prefer AdjustmentBox to Column because it allows more control.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    DisplayForm@AdjustmentBox[#, BoxBaselineShift -> 2 Mod[#, 3]] &], 
   None}]

enter image description here

Depending on your operating system and font, you can get some help from the FontTracking option:

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    Style[#, FontTracking -> "Narrow"] &], None}]

enter image description here

Personally I prefer Brett's solution, but I wanted to show a few alternative ways to move the chart labels vertically so they are away from each other.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
  ChartLabels -> {Placed[datalist[[All, 1]], Above], None}]

enter image description here

This version works much better if the labels are regularly spaced numbers. I prefer AdjustmentBox to Column because it allows more control.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    DisplayForm@AdjustmentBox[#, BoxBaselineShift -> 2 Mod[#, 3]] &], 
   None}]

enter image description here

Depending on your operating system and font, you can get some help from the FontTracking option:

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    Style[#, FontTracking -> "Narrow"] &], None}]

enter image description here

Source Link
Verbeia
  • 34.5k
  • 10
  • 110
  • 225

Personally I prefer Brett's solution, but I wanted to show a few alternative ways to move the chart labels vertically so they are away from each other.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 

ChartLabels -> {Placed[datalist[[All, 1]], Above], None}]

enter image description here

This version works much better if the labels are regularly spaced numbers. I prefer AdjustmentBox to Column because it allows more control.

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    DisplayForm@AdjustmentBox[#, BoxBaselineShift -> 2 Mod[#, 3]] &], 
   None}]

enter image description here

Depending on your operating system and font, you can get some help from the FontTracking option:

BarChart[datalist[[All, {2, 3}]], ChartLayout -> "Stacked", 
 ChartLabels -> {Placed[datalist[[All, 1]], Axis, 
    Style[#, FontTracking -> "Narrow"] &], None}]

enter image description here