This Question is related to this solved by @kglr and also this solved by @Henrik Schumacher.
I have a set of 3d positions and velocities of particles, and want to colorize the projected positions to the xz plane according to the x-velocity.
kglr solved this by usinge the following code:
SeedRandom[1];
posdata = RandomReal[10, {1000, 3}];
veldata = RandomReal[{-0.5, +0.5}, {1000, 3}];
clfun[val_] := Blend[{Blue, Green, Yellow, Red}, val];
xvelzypos = posdata;
xvelzypos[[All, 1]] = veldata[[All, 1]];
{xmin, xmax} = MinMax@veldata[[All, 1]];
legend = BarLegend[{clfun[Rescale[#, {xmin, xmax}]] &, {xmin, xmax}},
LegendLabel -> "vx", LegendMarkerSize -> {20, 300},
LabelStyle -> {FontFamily -> "Calibri", FontSize -> 15}];
xvzyplot =
Show[Graphics[{PointSize[0.03],
clfun[Rescale[#[[1]], {xmin, xmax}]],
Point[{#[[3]], #[[2]]}]} & /@ xvelzypos, Frame -> True,
FrameLabel -> {{"y", ""}, {"z", ""}}, AspectRatio -> Automatic,
PlotRange -> All,
BaseStyle -> {FontWeight -> "Bold", FontSize -> 20},
ImageSize -> 400]];
Legended[Graphics[
Inset[xvzyplot, Scaled[{.5, .5}], Automatic, Scaled[1]],
AspectRatio -> ImageAspectRatio@xvzyplot], legend]
The result is:
My question:
I would like to use a certain grid on the yz plane with values dy and dz. Each grid element should be color coded with the mean velocity of all particles that are projected to the corresponding grid element.
I tried to use parts of the solution of @Henrik Schumacher, but did not succeed.
How can be my problem solved?