How do I create a multiline plot using seaborn?

后端 未结 3 1655
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 13:55

I am trying out Seaborn to make my plot visually better than matplotlib. I have a dataset which has a column \'Year\' which I want to plot on the X-axis and 4 Columns say A,

3条回答
  •  庸人自扰
    2020-12-13 14:22

    See the documentation:

    sns.lineplot(x="Year", y="signal", hue="label", data=data_preproc)
    

    You probably need to re-organize your dataframe in a suitable way so that there is one column for the x data, one for the y data, and one which holds the label for the data point.

    You can also just use matplotlib.pyplot. If you import seaborn, much of the improved design is also used for "regular" matplotlib plots. Seaborn is really "just" a collection of methods which conveniently feed data and plot parameters to matplotlib.

提交回复
热议问题