python - axis range in scatter graphs - Stack Overflow
https://stackoverflow.com/questions/7376330You need to call legend for the legend to appear. The label kwarg only sets the _label attribute on the artist object in question. It's there for convenience, so that the label in the legend can be clearly associated with the plotting command. It won't add the legend to the plot without explicitly calling ax.legend(...).Also, you want ax.set_xlim, not ax.xlim to adjust the xaxis limits.