What are these markers at the bottom of BarLegend?
I get the same issue in version 11.3 (Wolfram Cloud):
$Version
"11.3.0 for Linux x86 (64-bit) (March 7, 2018)"
bl = BarLegend["Rainbow", LegendMarkerSize -> {100, 300}]
ImageResize[ImageCrop[Rasterize[bl, RasterSize -> 200], {Full, 100}, Top], 500]
This is caused by the option FrameTicks -> {{False, False}, {True, False}}
(that gets in there somewhere along the way):
Cases[ToBoxes[bl], p : Rule[FrameTicks, _], Infinity]
{FrameTicks -> {{False, False}, {True, False}}}
A work-around: post-process the box expression to modify FrameTicks
option value:
RawBoxes @ Replace[ToBoxes[bl], Rule[FrameTicks, _] :> Rule[FrameTicks, False], ∞]
Alternatively, change the setting for FrameTicksStyle
to White
:
RawBoxes@Replace[ToBoxes[bl], Rule[FrameTicksStyle, _]:> Rule[FrameTicksStyle, White], ∞]
same picture
kglr's answer shows a more comprehensive analysis of what is going on. However, if the goal is to export your graphic, there's a simple, but limited workaround. Testing shows that using Export
on a rasterized format will display the artefact ticks but NOT if the export is in vector graphics format.
Compare
Export["rasterbar.png",BarLegend["Rainbow"]]
and
Export["vectorbar.svg",BarLegend["Rainbow"]]
(*.pdf also works)