I am trying to make a costum legend in a Basemap
plot so was considering using Line2D
. It works ok, but I want that the legend only consist of one marker and no line, instead of a line between two markers (see below).
Here is the most important part of the code I use to plot this costum legend:
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
fig,ax = plt.subplots()
legend_elements = [Line2D([0],[0],marker='o',markersize=10,color='green',label='Label1'),
Line2D([0],[0],marker='s',markersize=12,color='red',label='Label2')]
ax.legend(handles=legend_elements,loc=2)
plt.show()