Is there a way to use logarithmically-spaced gridlines in BoxWhiskerChart? I've attempted manually specifying the gridlines as follows:

data = Table[RandomReal[{0, 1000}], {i, 1, 100}];
xticks = Flatten[Table[b*(10.^a), {a, Floor[Log10[Min[data]]], 
 Ceiling[Log10[Max[data]]]}, {b, 1, 9}]];

Then, when using ScalingFunctions -> "Log" in BoxWhiskerChart with these specified gridlines:

plot = BoxWhiskerChart[data, {{"Outliers", "o"}}, 
LabelStyle ->(FontSize -> 20), 
AspectRatio -> 1/2, ImageSize -> {600, 300}, 
PlotLabel -> "Data", 
GridLines -> {xticks, Automatic}, 
BarOrigin -> Left, 
ScalingFunctions -> "Log"]

I end up getting a screwy plot like this: bad gridlines

Setting both GridLines values to Automatic doesn't work either. Is this a chart limitation?

  • $\begingroup$ @JasonB. Great, that works! $\endgroup$
    – Alex
    Mar 7 '18 at 3:28
  • $\begingroup$ You can generate data like so data = Table[RandomReal[{0, 1000}], 100] or even this data=RandomReal[{0, 1000}, 100] $\endgroup$ Mar 7 '18 at 3:52

This just hasn't been implemented yet for BoxWhiskerChart. You can apply the Log function to the gridlines manually until it is

BoxWhiskerChart[data, {{"Outliers", "o"}}, 
 GridLines -> {Log @ xticks, Automatic}, BarOrigin -> Left, 
 ScalingFunctions -> "Log"]

enter image description here


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.