TransWikia.com

Seaborn Scatter plot

Data Science Asked by be1995 on October 15, 2020

I have a dataset containing of only one column, using matplotlib I was able to do the scatter plot the following way

data = pd.read_csv
plt.scatter(data.index,data.coulumn1)


I want the same graph using seaborn but I am not sure how to implement the same approach in the following line

ax = sns.scatterplot(x="total_bill", y="tip", data=tips)


2 Answers

Use same approach for seaborn which you have been using for matplotlib. Both works exactly same way.

plt.scatter(data.index, data.coulumn1)
sns.scatterplot(data.index, data.coulumn1)

Both will display same graph.

Answered by Swapnil Pote on October 15, 2020

ax = sns.scatterplot(x="total_bill", y="tip", data=tips)

With this format, Seaborn support Pandas DataFrame.
"total_bill" and "tip" are the name of the columns. "tips" is the pd.DataFrame.

You can plot on default Axis by

sns.scatterplot(x="X_Colname", y="Y_Colname", data=DataFrame)

#Can also pass the desired Axis to customize size etc.
sns.scatterplot(x="X_Colname", y="Y_Colname", data=DataFrame, ax=ax)

Answered by 10xAI on October 15, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP