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
  • 38,755
  • 12
  • 69
  • 79
Baron Yugovich
  • 3,551
  • 10
  • 42
  • 73

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
  • 38,755
  • 12
  • 69
  • 79
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'])
atomh33ls
  • 26,470
  • 23
  • 104
  • 159