Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Seaborn is plotting a line different from Matplotlib

Following is the simple dataset =

x = [7.5, 7.5, 17.5]
y = [393.198, 351.352, 351.352]

The output plot I am looking for is correctly produced by –

plt.plot(x,y) #right angle looking plot

However, I get weird plot when I do this in Seaborn –

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

sns.lineplot(x=x,y=y)

I don’t understand why Seaborn is producing this plot and how do I modify the Seaborn code to get the plot produced by Matplotlib?

>Solution :

Seaborn try doing some estimation and sorting with the data for better visualization of the relationship between x and y (document).

The below code produce the same chart with matplotlib

sns.lineplot(x=x,y=y, estimator=None, sort=False)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading