Q:

Read toothpaste sales data of each month and show it using a scatter plot

belongs to collection: Python Matplotlib Exercises

0

Read toothpaste sales data of each month and show it using a scatter plot

Also, add a grid in the plot. gridline style should “–“.

The scatter plot should look like this.

Matplotlib Exercise 4: Read toothpaste sales data of each month and show it using a scatter plot

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
import matplotlib.pyplot as plt  

df = pd.read_csv("D:\\Python\\Articles\\matplotlib\\sales_data.csv")
monthList  = df ['month_number'].tolist()
toothPasteSalesData = df ['toothpaste'].tolist()
plt.scatter(monthList, toothPasteSalesData, label = 'Tooth paste Sales data')
plt.xlabel('Month Number')
plt.ylabel('Number of units Sold')
plt.legend(loc='upper left')
plt.title(' Tooth paste Sales data')
plt.xticks(monthList)
plt.grid(True, linewidth= 1, linestyle="--")
plt.show()

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Get total profit of all months and show line plot ... >>
<< Read all product sales data and show it using a m...