Python and Matplotlib – Reduce lines of code

I have been coding in Python for a number of years now. I’ve always felt that Matplotlib code takes up a lot more lines of code than it should. I could be wrong.

I have the following function that plots a simple scatter plot graph with two additional solid lines. Is there any way for me to reduce the number of lines to achieve exactly the same outcome? I feel that my code is a little ‘chunky’.

dates contains an array of DateTime values in the yyyy-mm-dd H-M-S format

return_values – array of floats

ewma_values – array of floats

main_label – string

def plot_returns(dates, return_values, ewma_values, main_label):
    plt.figure(figsize=(15, 10))
    plt.scatter(dates, return_values, linestyle = '-', color='blue', s = 3, label = "Daily Returns")
    plt.plot(dates, ewma_values, linestyle = '-', color='green', label = "EWMA")
    plt.plot(dates, return_values.rolling(100).std(), linestyle = '-', color='red', label = "100 Day STDEV")
    plt.xlabel('Day', fontsize = 14)
    plt.ylabel('Return', fontsize = 14)
    plt.title(main_label, fontsize=14)
    plt.legend(loc='upper right', facecolor='white', edgecolor='black', framealpha=1, ncol=1, fontsize=12)
    plt.xlim(left = min(dates))

Thank you.