Suppose I am running an experiment with some subjects, and I obtain some numerical data from them. The subjects are divided into 2 experimental groups. Rather than display the means of each group in a bar graph, I would like to show their individual data. So I plot the data like so:
This is all fine and good, but let's say some individuals within a group have the same data. In this case, you would not be able to see each individual's data in a plot like this because their datapoints would completely overlap. Even individuals with data that was almost-the-same-but-not-quite would have some overlap, and it could be confusing to someone looking at the graph because they wouldn't see all the data.
In such a scenario, it would be useful to plot the data with individuals that have the same data just slightly offset from each other on the X-axis, like so:
This makes it so each datapoint is clear and visible for the reader.
Now comes the question: if I have a dataset that looks similar to the figure above, and I want to choose "x axis values" for each point to properly plot my data so that each datapoint is visible to the user, is there an algorithm that will essentially maximize distance of points from each other on the x-axis (within some pre-defined bounds, of course) while keeping their y-axis values constant?