Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am plotting data using ListPlot, but many of my data points are exactly overlapping and so the density of the data is not shown clearly.

I wonder if there is a way to solve this, either by 'jittering' the points or by adjusting the size of the points to reflect the density of points at a particular coordinate. Any other ideas would be very welcome.

share|improve this question
As you mention, jittering can be a good way to go. See…. With thousands (or more) points consider hexagon binning:…. – Jim Baldwin Mar 24 at 13:32

Considering you have duplicate points, you can use the number of times the data appears as your point size.

data = RandomReal[{0, 10}, {30, 2}];
data = Join[RandomChoice[data, 12], data]; (*duplicate data*)
data1 = Tally[data]; (*count number of appearance*)
Graphics[Disk[#[[1]], #[[2]] 0.1] & /@ data1, Frame -> True]

enter image description here


As pointed by Edmund, you can use BubbleChart as well. I think it is better.

data2 = data1 /. {{x_, y_}, z_} -> {x, y, z}

enter image description here

share|improve this answer
Have you seen BubbleChart? – Edmund Mar 24 at 12:10
thanks @Edmund. I did not know about BubbleChart. – Sumit Mar 24 at 12:26

Colour points in ListPlot using Style and your own colour function with Blend.

data = RandomInteger[{1, 5}, {100, 2}];

Create a colour function to colour each point. It will take the number of occurrences of the point. The function ranges from 1 to 10 over gray, orange, and blue.

colFunc = Blend[{{0, LightGray}, {.5, Orange}, {1, Blue}}, Rescale[#, {1, 10}]] &;

Use ListPlot's Style wrapper form for the data points. Also include a legend for the colours.

 ListPlot[Style[First@#, colFunc[Length@#]] & /@ Gather[data]],
 BarLegend[{colFunc, {1, 10}}, All]]

enter image description here

Hope this helps.

share|improve this answer

If you have many points, consider SmoothHistogram3D. Borrowing the code from @Sumit to duplicate random points:

data = RandomReal[{0, 10}, {300, 2}];
data = Join[RandomChoice[data, 60], data];


SmoothHistogram3D[data, 0.3]

where the second parameter adjust the sharpness of the smoothing.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.