2
$\begingroup$

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)


$\endgroup$
1
$\begingroup$

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 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)
```
| improve this answer | |
$\endgroup$
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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