Adjusting dot size in scatterplot

11,756

Solution 1

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.

Solution 2

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'])
Share:
11,756
Baron Yugovich
Author by

Baron Yugovich

Updated on June 04, 2022

Comments

  • Baron Yugovich
    Baron Yugovich almost 2 years

    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?