I have a 3 column data, x-coordinate, y-coordinate and a weight to color that particular point. As far as I know, there is no inbuilt Mathematica function that allows me to do so. So I am trying this with Grphics objects in the following way,
This is what my typical data looks for this particular plot
data = Table[{x, Sin[x], Sin[4*x]}, {x, -Pi, Pi, 0.001}];
I am using this data as my x,y coordinates and color in the following way
plot = Graphics[ Table[{Blend[{Red, Blue}, v[[3]]], Point[{v[[1]], v[[2]]}]}, {v, data}], Axes -> True]
I making the bar legend like this
legend = BarLegend[{Blend[{Red, Blue}, #] &, {-1, 1}}]
Legended
function does the jobLegended[plot, legend]
Although this does the job, the legend is out of proportion to the plot. Is there a better (natural) way of doing this?
Show[Legended[plot, legend], AspectRatio -> 1/GoldenRatio]
$\endgroup$