Seaborn: learning seaborn sucks

Created on 23 Jun 2019  路  2Comments  路  Source: mwaskom/seaborn

i wanted to make a simple plot today, and got sucked into seaborn, all i wanted to do was pass it a list of floats and get a plot with a regression line, but then i had to make the plot into a dataframe, so i had to import pandas just for this, then i had to reset index on the dataframe to get an x value, then the x value showed up as a float with too many decimal points, then i updated seaborn with conda and it lost all of my pip packages. fuck, all i wanted was a scatter plot with a moving average, not a lost hour+ of my life

Why can't we just do ... sns.regplot(list_of_floats) and get a plot without so much headache?

Most helpful comment

Thanks for the feedback!

All 2 comments

def compute_moving_average(interval, window_size):
    window = np.ones(int(window_size))/float(window_size)
    return np.convolve(interval, window, 'same')


def make_plot(changes):
    plt.clf()
    x = [i for i in range(len(changes))]
    if len(changes) > 5:
        moving_average = compute_moving_average(changes, 5)
        plt.plot(moving_average, 'r-')
    plt.scatter(x, changes)
    plt.savefig('changes.png')

this worked

Thanks for the feedback!

Was this page helpful?
0 / 5 - 0 ratings