pandas.DataFrame.plot.hexbin
pandas 3.1.1 · DataFrame · method
Count or summarize nearby x–y observations in hexagonal cells.
Call syntax
DataFrame.plot.hexbin(x, y, C=None, reduce_C_function=None, gridsize=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. |
C |
Optional Positional or keyword Default None |
int or str |
reduce_C_function |
Optional Positional or keyword Default None |
callable |
gridsize |
Optional Positional or keyword Default None |
int or tuple of (int, int) |
**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.hexbin(x="units", y="price", gridsize=4))