Take the 2-minute tour ×  I'm working on a plot with translucent
'x' markers (20% alpha). How do I make the marker appear at 100%
opacity in the legend?  import matplotlib.pyplot as plt
plt.plot_date( x = xaxis, y = yaxis, marker = 'x', color=[1, 0,
0, .2], label='Data Series' ) plt.legend(loc=3, mode="expand",
numpoints=1, scatterpoints=1 ) share|improve this question
Really an interesting question, quite useful. Thanks! –  Pablo
Navarro Oct 12 '12 at 13:38 add comment  1 Answer  up vote 1
down vote accepted  If you want to have something specific in
your legend, it's easier to define objects that you place in the
legend with appropriate text. For example:  import
matplotlib.pyplot as plt import pylab  line1 = pylab.Line2D(rang
e(1),range(1),color='white',marker='x',markersize=10,
markerfacecolor="red",alpha=1.0) line2 = pylab.Line2D(range(10),
range(10),marker="_",linewidth=3.0,color="dodgerblue",alpha=1.0)
plt.legend((line1,line2),('Text','Other
Text'),numpoints=1,loc=1)  Here, line1 defines a short, white l