4

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)


E199504
  • 605
  • 1
  • 6
  • 11

2 Answers2

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)
Zephyr
  • 997
  • 4
  • 10
  • 20
10xAI
  • 5,454
  • 2
  • 8
  • 24
1

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.

Swapnil Pote
  • 401
  • 3
  • 9