0% found this document useful (0 votes)
15 views2 pages

Program 4

The document provides two Python programs demonstrating how to create visualizations using Matplotlib. The first program generates a bar plot showing the number of used cars sold for different car brands, while the second program creates a scatter plot using random data points. Both programs include source code and titles for the plots.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Program 4

The document provides two Python programs demonstrating how to create visualizations using Matplotlib. The first program generates a bar plot showing the number of used cars sold for different car brands, while the second program creates a scatter plot using random data points. Both programs include source code and titles for the plots.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

4a) Write a Python program to Demonstrate how to Draw a Bar

Plot using Matplotlib.

SOURCE CODE
import [Link] as plt
import pandas as pd
# Create the dataset
data = {
"Car": ["BMW", "Audi", "Ford", "Tesla", "Toyota"],
"Number Sold": [50, 40, 70, 90, 65]
}
df = [Link](data)
# Extract columns
X = list(df["Car"])
Y = list(df["Number Sold"])
# Plot bar chart
[Link](X, Y, color='g')
[Link]("Used Car Sales")
[Link]("Car")
[Link]("Number Sold")
[Link]()

OUTPUT
4.b) Write a Python program to Demonstrate how to Draw a
Scatter Plot using Matplotlib.

SOURCE CODE
import [Link] as plt
import numpy as np
x = [Link](100)
y = [Link](100)
[Link](x, y)
[Link]('Scatter Plot')
[Link]('X')
[Link]('Y')
[Link]()

OUTPUT

You might also like