1

I am looking for a way to put a double mark on a data point using matplotlib.

We have such markers: https://matplotlib.org/examples/lines_bars_and_markers/marker_reference.html

My question is, how to locate two markers at the same position? For example, to put one maker on a data point we use 'o', and I want to get an effect of 'oo'

EveSz
  • 61
  • 6

1 Answers1

0

One possible solution would be to plot a pair of data points slightly offset from each other for each original data point. You could add and subtract a small value from the x-coordinate of the original data, and effectively get the two symbols near each other. Then it would be a matter of accurately scaling the marker size and the offset value as a function of the size of the plot, and you could have what you describe. However, this would not be nearly as flexible as simply defining a new custom marker.

After referring to this previously answered question, I found a way to accomplish something similar to what you describe in a more flexible way (using mathtext symbols):

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
s = np.random.rand(*x.shape) * 800 + 500

plt.plot(x, y, 'ko', marker=r'$\mathrm{oo}$', markersize=12)

![Plot with double circle marker at each point

Nathaniel
  • 3,230
  • 11
  • 18