Matplotlib: Scatter plot with multiple groups of individual vertical scatter plots

I am not sure if I understand your question correctly. You can do something similar to the previous question you link, but you add the color as a label and have the xticks read the algorithm number.

I am demonstrating with some random data.

import numpy as np
import matplotlib.pyplot as plt
np.random.seed(2022)

alg1_p1 = np.random.random(5).tolist()
alg1_p2 = np.random.random(5).tolist()
alg2_p1 = np.random.random(5).tolist()
alg2_p2 = np.random.random(5).tolist()

fig, ax = plt.subplots()
# we will keep the algorithm group locations at 1 and 2
xvals = ([0.9] * len(alg1_p1)) + ([1.9] * len(alg2_p1))
# plot the part1 points
ax.scatter(xvals, alg1_p1 + alg2_p1, c='red', label='part 1')
# plot the part2 points
xvals = ([1.1] * len(alg1_p2)) + ([2.1] * len(alg2_p2))
ax.scatter(xvals, alg1_p2 + alg2_p2, c='blue', label='part 2')
ax.set_xticks([1, 2])
ax.set_xticklabels(['Algorithm 1', 'Algorithm 2'])
ax.legend()
plt.show()

enter image description here