import pandas as pd
my_dict={
'visit':[50,53,55,57,59,60,61],
'sale':[8,9,11,12,14,16,17]
}
df =pd.DataFrame(data=my_dict)
df.plot.scatter(title='Sale Vs Visit',x='visit',y='sale')

df.plot.scatter(figsize=(6,3),x='visit',y='sale')
df.plot.scatter(x='visit',y='sale',fontsize=20)
We can use the option colors to give different colors to points . We can use one tuple to define the colours. Here it is color=[(.9,.4,.2)], this is in R G B format where each value varies from 0 to 1.
df.plot.scatter(title='Sale',x='visit',y='sale',color=[(.9,.4,.2)])
df.plot.scatter(title='grid=True',x='visit',y='sale',grid=True)
We can specify log scaling or symlog scaling for x ( logx=True ) or log scaling for y ( logy=True ), we can specify both the axis by loglog ( loglog=True)
df.plot.scatter(loglog=True,x='visit',y='sale')
df.plot.scatter(title='rot=180',x='visit',y='sale')
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.