Mathematica - BarChart3D:如何正确显示ChartLabels?

时间:2012-03-30 10:41:06

标签: wolfram-mathematica

我想把ChartLabels放在BarChart下面,但是当我使用'Below'选项时,ChartLabels会被系统地切割。

这是我的代码&和图:

data10000 = Import["results2_10000.dat"][[;; ;; 1]]
{{0.315364, 564.876}, {4.7499, 10.4077}, {6.12522, 8.51407}, {1.26482,
   55.5532}, {628.23, 1.58626}, {0.383874, 610.822}, {}}

figure3D10000 = BarChart3D[{SetPrecision[data10000[[1]], 2],
SetPrecision[data10000[[2]], 2],
SetPrecision[data10000[[3]], 2],
SetPrecision[data10000[[4]], 2],
SetPrecision[data10000[[5]], 2],
SetPrecision[data10000[[6]], 2]
},
ChartLabels ->
{Placed[{
  Text[Style["contiguous", 11]],
  Text[Style["chunks(79,157)", 11]],
  Text[Style["chunks(100,100)", 11]],
  Text[Style["chunks(1000,1000)", 11]],
  Text[Style["chunks(10000,1)", 11]],
  Text[Style["chunks(1,10000)", 11]]
  },
 Below,
 Rotate[#, Pi/2.5] &],
None
},
LabelingFunction -> Above,
ChartElementFunction -> "ProfileCube",
ChartLegends -> {Placed[{
   Text[Style["line per line", 11]],
   Text[Style["column per column", 11]]
  },
 Top]
},
AxesLabel -> {None, None, Style["time"[s], FontSize -> 11]},
AxesStyle -> {None, None, {Directive[13], Thickness -> 0.004}},
PlotRange -> {All, All}
]

不幸的是,我不能发布这个数字,因为我是新用户。但是,如果您测试此代码,您将看到BarChart下的标签几乎不可见。

1 个答案:

答案 0 :(得分:1)

使用ImagePadding进行了一些改进:

data10000 = {{0.315364, 564.876}, {4.7499, 10.4077}, {6.12522, 
   8.51407}, {1.26482, 55.5532}, {628.23, 1.58626}, {0.383874, 
   610.822}, {}}

figure3D10000 = 
 BarChart3D[{SetPrecision[data10000[[1]], 2], 
   SetPrecision[data10000[[2]], 2], SetPrecision[data10000[[3]], 2], 
   SetPrecision[data10000[[4]], 2], SetPrecision[data10000[[5]], 2], 
   SetPrecision[data10000[[6]], 2]}, 
  ChartLabels -> {Placed[{Text[Style["contiguous", 11]], 
      Text[Style["chunks(79,157)", 11]], 
      Text[Style["chunks(100,100)", 11]], 
      Text[Style["chunks(1000,1000)", 11]], 
      Text[Style["chunks(10000,1)", 11]], 
      Text[Style["chunks(1,10000)", 11]]}, Below, 
     Rotate[#, Pi/2.5] &], None}, LabelingFunction -> Above, 
  ChartElementFunction -> "ProfileCube", 
  ChartLegends -> {Placed[{Text[Style["line per line", 11]], 
      Text[Style["column per column", 11]]}, Top]}, 
  AxesLabel -> {None, None, Style["time [s]", FontSize -> 11]}, 
  AxesStyle -> {None, None, {Directive[13], Thickness -> 0.004}}, 
  PlotRange -> {All, All}, ImagePadding -> 110, ImageSize -> 600]