Label, title, and axis names
📖 Scenario: You are analyzing monthly sales data for a small store. You want to create a simple line chart to show how sales changed over the first six months of the year.
🎯 Goal: Create a line chart using matplotlib with proper labels for the x-axis and y-axis, and add a title to the chart.
📋 What You'll Learn
Create a list called
months with the values: 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'Create a list called
sales with the values: 250, 300, 280, 350, 400, 420Use
plt.plot() to create a line chart with months on the x-axis and sales on the y-axisAdd the x-axis label
'Month' using plt.xlabel()Add the y-axis label
'Sales' using plt.ylabel()Add the chart title
'Monthly Sales Data' using plt.title()Display the chart using
plt.show()💡 Why This Matters
🌍 Real World
Labeling charts clearly helps people understand data trends quickly, such as sales over months or temperatures over days.
💼 Career
Data scientists and analysts often create charts with clear labels and titles to communicate insights effectively to teams and clients.
Progress0 / 4 steps