Examples
The following examples are generated with random data from a normal distribution.

In [1]:
import numpy as np
import pandas as pd
In [4]:
n = 1000
df = pd.DataFrame({'x': np.random.randn(n),
                   'y': np.random.randn(n)})
ax = df.plot.hexbin(x='x', y='y', gridsize=30)

The next example uses C and np.sum as reduce_C_function. Note that ‘observations’ values
ranges from 1 to 5 but the result plot shows values up to more than 25. This is because
of the reduce_C_function.

In [5]:
n = 800
df = pd.DataFrame({
    'coord_x': np.random.uniform(-5, 5, size=n),
    'coord_y': np.random.uniform(20, 40, size=n),
    'observations': np.random.randint(1,5, size=n)
    })
ax = df.plot.hexbin(x='coord_x',
                    y='coord_y',
                    C='observations',
                    reduce_C_function=np.sum,
                    gridsize=20,
                    cmap="viridis")