Kishan
Kishan

Reputation: 352

how to plot a scatter plot if there are hundreds of rows in a column using matplotlib or seaborn

x axis is cluttered on the chart with 100 rows.How to deal with this kind of columns?

  plt.scatter(data=ipl,x='budget',y='player')

enter image description here

Upvotes: 0

Views: 122

Answers (1)

Sheldore
Sheldore

Reputation: 39052

You can try showing every nth tick-label on the x-axis

fig, ax = plt.subplots()

ax.scatter(data=ipl,x='budget',y='player')

n = 4

for idx, label in enumerate(ax.xaxis.get_ticklabels()):
    if idx % n != 0:
        label.set_visible(False)

Upvotes: 1

Related Questions