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

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 2

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)

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.