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

Python Matplotlib Practicals

The document contains Python code that uses Matplotlib to create three types of visualizations: a bar chart showing employee salaries, a histogram representing salary distribution, and a pie chart illustrating the share of total payroll among employees. Each chart is customized with titles, labels, and gridlines for clarity. The code demonstrates data visualization techniques for analyzing and presenting salary data.

Uploaded by

kshitijasingh24
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)
8 views2 pages

Python Matplotlib Practicals

The document contains Python code that uses Matplotlib to create three types of visualizations: a bar chart showing employee salaries, a histogram representing salary distribution, and a pie chart illustrating the share of total payroll among employees. Each chart is customized with titles, labels, and gridlines for clarity. The code demonstrates data visualization techniques for analyzing and presenting salary data.

Uploaded by

kshitijasingh24
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/ 2

import matplotlib.

pyplot as plt

import numpy as np

# Sample Data

employees = ['Alice', 'Bob', 'Charlie', 'David', 'Eva']

salaries = [50000, 60000, 55000, 70000, 65000]

# 1. Bar Chart

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

plt.bar(employees, salaries, color='skyblue')

plt.title('Employee Salaries - Bar Chart')

plt.xlabel('Employees')

plt.ylabel('Salary ($)')

plt.grid(axis='y', linestyle='--')

plt.tight_layout()

plt.show()

# 2. Histogram (Salary Distribution)

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

plt.hist(salaries, bins=5, color='green', edgecolor='black')

plt.title('Salary Distribution - Histogram')

plt.xlabel('Salary ($)')

plt.ylabel('Number of Employees')

plt.grid(axis='y', linestyle='--')

plt.tight_layout()

plt.show()

# 3. Pie Chart (Share of Total Payroll)

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

plt.pie(salaries, labels=employees, autopct='%1.1f%%', startangle=140)

plt.title('Payroll Distribution - Pie Chart')


plt.tight_layout()

plt.show()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy