Programs · Program 4-9
Q.(Program 4-9) Taking the same data as Program 4-8 (Name: ['Arnav', 'Sheela', 'Azhar', 'Bincy', 'Yash', 'Nazar'], Height: [60, 61, 63, 65, 61, 60], Weight: [47, 89, 52, 58, 50, 47]), customise the histogram: change the edgecolor (the border of each hist) to green, the line style to ":", the line width to 2, set fill to False, and fill each hist with the hatch pattern "o".
Yanam CbseNCERTSubjective· 4mImportance★★★★★est
27% · 12/44 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Style the histogram (both series together) with an unfilled, dotted, green-edged look.
import pandas as pd
import matplotlib.pyplot as plt
data = {'Name':['Arnav', 'Sheela', 'Azhar', 'Bincy', 'Yash', 'Nazar'],'Height' : [60,61,63,65,61,60],'Weight' : [47,89,52,58,50,47]}
df=pd.DataFrame(data)
df.plot(kind='hist',edgecolor='Green',linewidth=2,linestyle=':',fill=False,hatch='o')
plt.show()
The styling (edgecolor, linewidth, linestyle, fill=False, hatch) is applied to the WHOLE DataFrame in one df.plot(kind='hist', ...) call, producing a single chart with both Height and Weight -- not two separate charts.
Step by step
- Same DataFrame as Program 4-8, same
kind='hist'call, but five extra style keywords change how each bar is DRAWN, not what data is plotted. fill=Falseremoves the solid colour fill, so each bar becomes just its outline. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.