plt scatter size code example

Example 1: how to decrease size of graph in plt.scatter

fig, ax = plt.subplots(figsize=(10, 6))

Example 2: how to decrease size of graph in plt.scatter

#In cmd
pip install scikit-learn

#Or in Conda
conda install scikit-learn

import sklearn
from sklearn import datasets

Example 3: python scatter size

This can be a somewhat confusing way of defining the size but you are basically specifying the area of the marker. This means, to double the width (or height) of the marker you need to increase s by a factor of 4. [because A = WH => (2W)(2H)=4A]

There is a reason, however, that the size of markers is defined in this way. Because of the scaling of area as the square of width, doubling the width actually appears to increase the size by more than a factor 2 (in fact it increases it by a factor of 4). To see this consider the following two examples and the output they produce.