0
0
Matplotlibdata~15 mins

Markers on data points in Matplotlib - Mini Project: Build & Apply

Choose your learning style9 modes available
Markers on data points
📖 Scenario: You are analyzing sales data for a small store. You want to visualize the sales numbers for each day of the week using a simple line chart. To make the data points clear, you will add markers on each point.
🎯 Goal: Create a line plot of sales data with markers on each data point to clearly show the sales values for each day.
📋 What You'll Learn
Create a list called days with the days of the week as strings.
Create a list called sales with the sales numbers for each day.
Use matplotlib.pyplot to plot the sales data.
Add markers on each data point using the marker parameter.
Display the plot with plt.show().
💡 Why This Matters
🌍 Real World
Markers on data points help highlight exact values in charts, making it easier to understand trends and compare data in reports or presentations.
💼 Career
Data analysts and scientists use markers in plots to communicate insights clearly to stakeholders and to explore data visually during analysis.
Progress0 / 4 steps
1
Create the sales data lists
Create a list called days with these exact values: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'. Also create a list called sales with these exact values: 150, 200, 170, 220, 180, 190, 210.
Matplotlib
Need a hint?

Use square brackets to create lists. Separate items with commas.

2
Import matplotlib and set up the plot
Import matplotlib.pyplot as plt. This will allow you to create the plot.
Matplotlib
Need a hint?

Use import matplotlib.pyplot as plt to import the plotting library.

3
Plot the sales data with markers
Use plt.plot() to plot days on the x-axis and sales on the y-axis. Add markers on each data point by setting the marker parameter to 'o'.
Matplotlib
Need a hint?

Use marker='o' inside plt.plot() to add circle markers.

4
Display the plot
Use plt.show() to display the plot with markers.
Matplotlib
Need a hint?

Call plt.show() to open the plot window.