I want to plot a big 2D array of experiment data. I need plot axes and tick labels as well as a bar legend using BarLegend
:
ArrayPlot[
Array[RandomInteger[100] &, {100, 100}],
PlotLegends -> Placed[Automatic, Below],
ImageSize -> 200,
PlotLabel -> "Test",
FrameLabel -> {"Axes", "Dimensions"},
FrameTicks -> Automatic,
BaseStyle -> {FontSize -> 14}
]
The output I get is
I am not happy with the size of the BarLegend
. I would like to have the BarLegend
with the width and horizontal offset of the actual plot. It properly scales with the image size, if I don't use the PlotLabel
, FrameTicks
and FrameLabel
but I need all of them.
I would be happy also with the solutions, which does work in general case, but needs adjusting some number by hand. So far I have figured out, that I can change the horizontal offset with PlotLegends -> Placed[BarLegend[Automatic, LegendMargins -> {{20, 20}, {0, 0}}], Below]
, but this does not make the legend smaller.
As the BarLegend
does not return Graphics
, I can not just use Scale[BarLegend["BlueGreenYellow", LegendMargins -> {{20, 20}, {0, 0}}], 2]
etc.
Side note: For plotting experiment data I use ArrayPlot
instead of ListContourPlot
and similar because they get very slow for big arrays. And at least ListContourPlot
suffers from the same problem.