ChartBaseStyle in BarChart3D - possible bug
This appears to be an oversight in how EdgeForm[None]
(the default for $\geq100$ bars) is handled when combining the different style directives for the bars1. Essentially, EdgeForm[None]
overrides any explicit EdgeForm
settings, which is why they are not applied in the second case (where there are $\geq100$ bars).
To circumvent this, you can execute the following code once before plotting anything:
Charting`iBarChart3D[{}];
prot = Unprotect@Charting`iBarChart3D;
DownValues@Charting`iBarChart3D =
DownValues@Charting`iBarChart3D /.
HoldPattern[
lhs : _["ChartBaseStyle"] = cd_[
If[cond_,
then_,
else_
],
rest__
]
] :> (
If[cond,
lhs = cd[rest];
If[! MemberQ[lhs, _EdgeForm],
AppendTo[lhs, then]
],
lhs = cd[else, rest]
]
);
Protect /@ prot;
Now the second example works as expected:
BarChart3D[RandomReal[1, {10, 10}], ChartLayout -> "Grid",
ChartBaseStyle -> EdgeForm[{Thickness[.01], Opacity[1]}],
BarSpacing -> {0.7, 0.7}]
This works by modifying the way the default style for many bars in handled: Instead of simply adding EdgeForm[None]
to the list of directives (which overrides any other specifications), we combine the remaining directives first. If no explicit EdgeForm
directive is present, we manually append EdgeForm[]
to the list.
1The relevant code is in Charting`iBarChart3D
(look for styleData["ChartBaseStyle"] = ...
; handles the default styles for the bars), Charting`ConstructDirective
(handles the combining of the styles) and Charting`ConstructDirectiveOrNone
(handles the override of EdgeForm[None]
)