Saving figures
📖 Scenario: You have created a simple line plot showing sales data over a week. Now, you want to save this plot as an image file so you can share it or use it in reports.
🎯 Goal: Create a line plot using sales data and save the figure as a PNG file named sales_plot.png.
📋 What You'll Learn
Create a list called
sales with the values: 150, 200, 250, 300, 280, 320, 400Create a list called
days with the values: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'Use matplotlib to plot
sales against daysSave the figure as
sales_plot.png using matplotlib's savefig methodPrint the message
"Figure saved as sales_plot.png" after saving💡 Why This Matters
🌍 Real World
Saving figures is important when you want to share your data visualizations with others or include them in reports and presentations.
💼 Career
Data scientists and analysts often save plots to communicate insights clearly and professionally.
Progress0 / 4 steps