Replace Hue
with ColorData["M10DefaultDensityGradient"]
to use the default color scheme for DensityPlot
:
barlegend1 = BarLegend[{"M10DefaultDensityGradient", MinMax@xyz[[All, -1]]}];
barlegend2 = BarLegend[{"M10DefaultDensityGradient", MinMax@xyz[[All, -1]]},
xyz[[All, -1]]];
Row[{barlegend1, barlegend2}, Spacer[20]]
Legended[Graphics[{EdgeForm[Gray], Opacity[1],
ColorData["M10DefaultDensityGradient"] @ #3, Rectangle[{#, #2}]} & @@@ xyz,
Frame -> True],
barlegend2]
BubbleChart[xyz,
ChartStyle -> (ColorData["M10DefaultDensityGradient"] /@ xyz[[All, -1]]),
ChartElementFunction -> (Rectangle[Mean /@ #] &),
PlotRange -> {{0, 11}, {0, 11}}, ChartLegends -> barlegend2]
For DensityHistogram
, just remove the option ColorFunction -> Hue
:
DensityHistogram[WeightedData[xyz[[All, ;; 2]], xyz[[All, -1]]], {1},
ChartElementFunction -> (Rectangle[Mean /@ #] &),
ChartLegends -> BarLegend[Automatic, xyz[[All, -1]]]]