Mathematica Asked by Pjana on January 11, 2021
I have a list of points ( a list with sub lists which are {x,y} coordinates. I would like to have a listplot where the areas with higher density of points are in darker colors and areas with lower density of points have lighter colors so it is visually visible that in some areas points might overlap each other.
points = Join[
RandomVariate[
MultinormalDistribution[{-0.5, 0.25}, 0.07*IdentityMatrix[2]],
1000],
RandomVariate[
MultinormalDistribution[{0.6, -0.1}, 0.03*IdentityMatrix[2]],
1000],
RandomReal[{-1.5, 1.5}, {1000, 2}]
];
skd = SmoothKernelDistribution[points];
ListPlot[points,
ColorFunction -> Function[{x, y}, Hue[PDF[skd, {x, y}]]],
ColorFunctionScaling -> False, AspectRatio -> 1]
Answered by flinty on January 11, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP