It is not clear from your question what you mean by mapping. In case you are looking to modify the legend handles from default markers to custom variable markers, you can do the following. My solution was based on this answer but simplified to present a simple case example. Don't forget to upvote the original answer. I already did as an acknowledgement.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
fig, ax = plt.subplots()
new_legends = ["X", "Y"]
markers = ['s', 'o']
colors = ['r', 'b']
x = np.arange(5)
plt.plot(x, 1.5*x, marker=markers[0], color=colors[0], label='squares')
plt.plot(x, x, marker=markers[1], color=colors[1], label='circles')
_, labels = ax.get_legend_handles_labels()
def dupe_legend(label, color):
line = Line2D([0], [0], linestyle='none', mfc='black',
mec=color, marker=r'$\mathregular{{{}}}$'.format(label))
return line
duplicates = [dupe_legend(leg, color) for leg, color in zip(new_legends, colors)]
ax.legend(duplicates, labels, numpoints=1, markerscale=2, fontsize=16)
plt.show()
