(Program 4-17) Consider the dataset of Table 4.10 showing the forest cover of north eastern states that contains geographical area and corresponding forest cover in sq km along with the names of the corresponding states.
Table 4.10 -- forest cover of north eastern states:
| State | GeoArea | ForestCover |
|---|---|---|
| Arunachal Pradesh | 83743 | 67353 |
| Assam | 78438 | 27692 |
| Manipur | 22327 | 17280 |
| Meghalaya | 22429 | 17321 |
| Mizoram | 21081 | 19240 |
| Nagaland | 16579 | 13464 |
| Tripura | 10486 | 8073 |
| Plot a pie chart of the ForestCover column with the title 'Forest cover of North Eastern states' and legend turned off. |
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 →A pie chart is the wrong choice for this data — it has too many categories (7 states) for a pie chart to be readable. The correct approach is to plot it as asked, but understand why a bar chart would be better.
This is a code task — you need to write Python code using matplotlib to produce the specified pie chart from the given data.
Why a pie chart here is problematic
Pie charts work well for 2–5 categories where you want to show proportions of a whole. With 7 states, the slices become too small to distinguish, and comparing areas like Manipur (17280) vs Meghalaya (17321) is nearly impossible by eye. A bar chart would let you compare absolute values easily. But the question explicitly asks for a pie chart, so we follow instructions while noting the limitation.
The data
From Table 4.10:
| State | GeoArea (sq km) | ForestCover (sq km) |
|---|---|---|
| Arunachal Pradesh | 83743 | 67353 |
| Assam | 78438 | 27692 |
| Manipur | 22327 | 17280 |
| Meghalaya | 22429 | 17321 |
| Mizoram | 21081 | 19240 |
| Nagaland | 16579 | 13464 |
| Tripura | 10486 | 8073 |
We only need the State and ForestCover columns for the pie chart.
The code
import matplotlib.pyplot as plt
# Data
states = ['Arunachal Pradesh', 'Assam', 'Manipur', 'Meghalaya', 'Mizoram', 'Nagaland', 'Tripura']
forest_cover = [67353, 27692, 17280, 17321, 19240, 13464, 8073]
# Create pie chart
plt.figure(figsize=(8, 6))
plt.pie(forest_cover, labels=states, autopct='%1.1f%%')
plt.title('Forest cover of North Eastern states')
plt.legend().remove() # Turn off legend
plt.show()
Key lines explained
plt.pie(forest_cover, labels=states, autopct='%1.1f%%')— The first argument is the data values.labelsgives each slice a name.autopctadds percentage labels on each slice, formatted to one decimal place. …
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.