5
$\begingroup$

Bug introduced in 8.0 or earlier and fixed in 13.2.0 or earlier


So I have been fighting with this for a while. I'm trying to get custom frame ticks on both the left and right side of a DistributionChart. It's not going very well. It just keeps throwing errors saying tick position needs to be a number. Which in my code it is. Here is an example:

With[
 {fps = {120, 60, 50, 40, 30, 25, 20, 15, 10}},
 DistributionChart[
  RandomVariate[SkewNormalDistribution[##], 100] & @@@ {{20, 13, 5}, {30, 12, 10}},
  ChartLabels -> {1, 2},
  PlotRange -> {0, 70},
  GridLines -> {None, N@Table[1/i*1000, {i, fps}]},
  FrameTicks -> {
   {
     Table[{N[1/i*1000], NumberForm[N[1/i*1000], 3]}, {i, fps}],(*Left*)
     Table[{1/i*1000, i}, {i, fps}] (*Right*)
   },
   {
     None,(*Bottom*)
     None (*Top*)
   }
  }
 ]
]

Any help would be much appreciated.

$\endgroup$
2
  • $\begingroup$ It seems there is a bug in there. Try AbsoluteOptions@ DistributionChart[RandomReal[BetaDistribution[2, 1/4], {6, 100}]] $\endgroup$ Oct 7, 2012 at 19:52
  • $\begingroup$ This example from the documentation for DistributionChart also has a problem with Ticks: DistributionChart[data, ChartLabels -> {"a", "b", "c"}] AbsoluteOptions[%] $\endgroup$
    – DavidC
    Oct 7, 2012 at 20:05

2 Answers 2

5
$\begingroup$

There seems to be a bug here as even

DistributionChart[{{1, 2, 3, 4, 5}, {1, 1, 2, 3}}, FrameTicks -> {{None, None}, {None, None}}]

yields an error, but you can work around it as follows:

With[{fps = {120, 60, 50, 40, 30, 25, 20, 15, 10}}, 
 DistributionChart[
   RandomVariate[SkewNormalDistribution[##], 100] & @@@ {{20, 13, 5}, {30, 12, 10}}, 
   ChartLabels -> {1, 2}, PlotRange -> {0, 70}, 
   GridLines -> {None, N@Table[1/i*1000, {i, fps}]}
 ] /. 
  Rule[FrameTicks, __] -> 
   Rule[FrameTicks, {{Table[{N[1/i*1000],NumberForm[N[1/i*1000], 3]}, {i, fps}],(*Left*)
      Table[{1/i*1000, i}, {i, fps}] (*Right*)}, {None,(*Bottom*) None (*Top*)}}]
]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Thank you. Your workaround works perfectly. DistributionChart seems quite buggy. This is not the first bug in it I've run in to. $\endgroup$
    – Mr Alpha
    Oct 8, 2012 at 12:19
1
$\begingroup$

The issue has been resolved in the latest -13.2.0- version or earlier

The code from the OP

With[{fps = {120, 60, 50, 40, 30, 25, 20, 15, 10}}, 
 DistributionChart[
  RandomVariate[SkewNormalDistribution[##], 100] & @@@ {{20, 13, 
     5}, {30, 12, 10}}, ChartLabels -> {1, 2}, PlotRange -> {0, 70}, 
  GridLines -> {None, N@Table[1/i*1000, {i, fps}]}, 
  FrameTicks -> {{Table[{N[1/i*1000], NumberForm[N[1/i*1000], 3]}, {i,
        fps}],(*Left*)
     Table[{1/i*1000, i}, {i, fps}] (*Right*)}, {None,(*Bottom*)
     None (*Top*)}}]]

Screenshot for completeness

screen

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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