# Scatter plot with bar legend [duplicate]

I have two data sets:

xy = {{x1, y1}, {x2, y2}, ...}
z = {z1, z2, ...}


I want to plot at each (xi, yi) a point in a two dimensional plane, but color coded according to the value of zi. Next to the plot I want a BarLegend with blue corresponding to the smallest z value and red corresponding to the largest z value.

I already have some code, but I think the Legend is still missing. Of course other more simpler solutions are also welcome.

 colorf = Blend[{{Min[z], Blue}, {Max[z], Red}}, #] &
pl =
Axes -> True, AspectRatio -> 1,
AxesLabel -> {OverTilde["x"], OverTilde["y"]}]

• If you can tell me how to introduce a title in the legend then I agree! – Jan SE Dec 19 '17 at 19:01

xy = RandomVariate[NormalDistribution[], {5000, 2}];