3

I want to plot a hundred or so points on a world map. Some of the points are too close together, so I would like to be able to separate them, so that they are still approximately in the correct position, but not overlapping the neighbouring points.

Something like this might be useful in some cases, but in others it's going to make previously non-overlapping neighbours overlap.

Is there a nice way to do this in matplotlib, or will I have to manually code some kind of force-sprung separator before plotting?

4
  • Maybe answers to this question can help: stackoverflow.com/questions/8671808/… Commented Jul 28, 2017 at 6:48
  • To make it short, there is no built-in feature that spreads points in matplotlib. Writing your own algorithm that does it, or looking for similar problems online is necessary. The more of your efforts in finding a solution (either through writing code or through sharing your research) you show the higher the chances someone jumps in and provides help on the issue. Commented Jul 28, 2017 at 10:05
  • @Shaido: I don't want jitter. I want something deterministic, so that if e.g A and B are overlapping, they move away from their midpoint an equal distance. If three points are overlapping, they also move away from their midpoint proportionally to the amount of overlap, etc. Commented Jul 29, 2017 at 8:38
  • @ImportanceOfBeingErnest: Yes, I know. I'm just aware of e.g. position_dodge in ggplot2, which does this, but only in one dimension, and I was wondering if there was something that already existed that I wasn't aware of. Commented Jul 29, 2017 at 8:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.