Skip to content
Programs · Program 4-7

Q.(Program 4-7) Write a Python script to display Bar plot for the "MelaSales.csv" file with column Day on x axis, and having the following customisation: changing the color of each bar to red, yellow and purple; edgecolor to green; linewidth as 2; line style as "--".

Puducherry TnboardTextbookSubjective· 4mImportance★★★★★est
23% · 10/44 Questions
🔒 Locked · start free trial →

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 grouped bar chart with custom colours, edge colour, and edge style.

import pandas as pd
import matplotlib.pyplot as plt
df= pd.read_csv('MelaSales.csv')
df.plot(kind='bar',x='Day',title='Mela Sales Report',color=['red','yellow','purple'],edgecolor='Green',linewidth=2,linestyle='--')
plt.ylabel('Sales in Rs')
plt.show()

All three week-columns are still plotted (not just one); the styling arguments (color list, edgecolor, linewidth, linestyle) go straight into the same df.plot(kind='bar', ...) call.

Step by step

  1. Same grouped bar chart as Program 4-6, still x='Day' so all three week-columns are plotted (not just one).
  2. color=['red','yellow','purple'] recolours the three week-series in that order. …

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.