import pandas as pd
import numpy as np
n = 10000
df=pd.DataFrame({'x': np.random.randn(n),
'y': np.random.randn(n)})
ax=df.plot.hexbin(x='x',y='y',gridsize=20)

df.plot.hexbin(x='x',y='y',gridsize=20,figsize=(6,3))
df.plot.hexbin(x='x',y='y',gridsize=20,fontsize=20)
We can use the option colors to give different colors to line . We can use one tuple to define the colours.
df.plot.hexbin(x='x',y='y',gridsize=20,title='hexbin Plot',color=[(.9,.2,.6)])
df.plot.hexbin(x='x',y='y',gridsize=20,title='grid=True',grid=True)
We can specify log scaling or symlog scaling for x ( logx=True ) or y ( logy=True ) or for both x & y ( loglog=True)
df.plot.hexbin(x='x',y='y',gridsize=20,title='loglog=True',loglog=True)
Pandas plot
plot.barh()
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.