2

I am doing

ax = df.plot(x=x_col, y=y_col, style=['o', 'rx'])

but I don't like that the data points are large circles. I have thousands of datapoints, so it makes the plot ugly. Any idea how I can make the dots smaller, i.e. have them be actual points, rather than circles? Or any alternative suggestions for this sort of scatterplot?

Stefan
  • 41,759
  • 13
  • 76
  • 81
Baron Yugovich
  • 3,843
  • 12
  • 48
  • 76

2 Answers2

5

The DataFrame.plot() docs include the option to pass keyword arguments to the underlying matplotlib plotting method. As you can see here, there's an argument s for the dot size. So you should be able to:

ax = df.plot(kind='scatter', x=x_col, y=y_col, style=['o', 'rx'], s=12)

This is also illustrated in the pandas visualization docs.

Community
  • 1
  • 1
Stefan
  • 41,759
  • 13
  • 76
  • 81
1

The valid matplotlib marker styles include; '.' (point) and ',' (pixel).

So an alternative could be:

ax = df.plot(x=x_col, y=y_col, style=['.', 'rx'])
Lee
  • 29,398
  • 28
  • 117
  • 170