0% found this document useful (0 votes)
7 views3 pages

Codes R

Uploaded by

saarikgowshik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Codes R

Uploaded by

saarikgowshik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

import pandas as pd

import matplotlib.pyplot as plt

# Data for number of songs composed by foreign artists

No_of_songs = [63, 87, 305, 76, 150]

Artist = ['Ed Sheeran', 'Rihanna', 'The Weeknd', 'Justin Bieber', 'Michael Jackson']

# Bar graph

plt.figure(figsize=(8, 5))

plt.bar(Artist, No_of_songs, color=['red', 'green', 'yellow', 'blue', 'magenta'])

plt.title("Number of Songs Composed by Foreign Artists - Bar Graph", fontsize=14)

plt.xlabel("Artists", fontsize=12)

plt.ylabel("Number of Songs", fontsize=12)

plt.xticks(rotation=45)

plt.show()
import pandas as pd

import matplotlib.pyplot as plt

# Data for number of songs composed by foreign artists

No_of_songs = [63, 87, 305, 76, 150]

Artist = ['Ed Sheeran', 'Rihanna', 'The Weeknd', 'Justin Bieber', 'Michael Jackson']

# Line graph

plt.figure(figsize=(8, 5))

plt.plot(Artist, No_of_songs, marker='o', linestyle='-', color='blue', markerfacecolor='red')

plt.title("Number of Songs Composed by Foreign Artists - Line Graph", fontsize=14)

plt.xlabel("Artists", fontsize=12)

plt.ylabel("Number of Songs", fontsize=12)

plt.xticks(rotation=45)

plt.grid(True)

plt.show()
import pandas as pd

import matplotlib.pyplot as plt

# Data for number of songs composed by foreign artists

No_of_songs = [63, 87, 305, 76, 150]

# Histogram

plt.figure(figsize=(8, 5))

plt.hist(No_of_songs, bins=5, color='skyblue', edgecolor='black')

plt.title("Distribution of Songs Composed by Foreign Artists - Histogram", fontsize=14)

plt.xlabel("Number of Songs", fontsize=12)

plt.ylabel("Frequency", fontsize=12)

plt.grid(True)

plt.show()

You might also like