pandas.DataFrame.plot.scatter
pandas 3.1.1 · DataFrame · method
Plot pairs of values as points to show their relationship.
Call syntax
DataFrame.plot.scatter(x, y, s=None, c=None, **kwargs)Inspect the call
Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
x |
Required Positional or keyword |
int or str Choose the column or positional input mapped to the horizontal axis. |
y |
Required Positional or keyword |
int or str Choose the column or positional input mapped to the vertical axis. |
s |
Optional Positional or keyword Default None |
str, scalar or array-like |
c |
Optional Positional or keyword Default None |
str, int or array-like |
**kwargs |
Optional Additional keyword arguments |
Returns
matplotlib.axes.Axes or numpy.ndarray of them
Example for a local Python session
import pandas as pd
import matplotlib
frame = pd.DataFrame({"units": [2., 5., 7.], "price": [4., 3., 2.]})
print(frame.plot.scatter(x="units", y="price"))