Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
11 views
10 pages
PHY1003 Assignment 1
It has 10 python codes for plotting basic 2D and 3D graphs
Uploaded by
adx.222005
AI-enhanced title
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
Download
Save
Save PHY1003_Assignment_1 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
11 views
10 pages
PHY1003 Assignment 1
It has 10 python codes for plotting basic 2D and 3D graphs
Uploaded by
adx.222005
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save PHY1003_Assignment_1 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save PHY1003_Assignment_1 For Later
You are on page 1
/ 10
Search
Fullscreen
ASSIGNMENT 1
Question 1: Basic 2D Line Plot
import matplotlib . pyplot as plt
days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
temp = [22,24,21,19,20,23,25]
plt.plot ( days,temp,marker ='o',linestyle ='-',color ='green')
plt.xlabel ("Days")
plt.ylabel ("Temperature")
plt. tle ("Temperature Data")
plt.show ()
Question 2: Multiple Line Plot
import matplotlib.pyplot as plt
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
'Dec']
store_A = [500, 700, 800, 650, 900, 1000, 1100, 950, 1050, 1200, 1300, 1400]
store_B = [400, 600, 700, 800, 750, 900, 950, 850, 900, 1000, 1100, 1150]
plt.figure(figsize=(10, 6))
plt.plot(months, store_A, label='Store A', marker='o', linestyle='-', color='blue')
plt.plot(months, store_B, label='Store B', marker='o', linestyle='-',
color='green')
plt. tle('Revenue Data')
plt.xlabel('Months')
plt.ylabel('Revenue')
plt.legend()
plt.show()
Question 3: Bar Graph
import matplotlib.pyplot as plt
books = ['Fic on', 'Non-Fic on', 'Mystery', 'Sci-Fi', 'Fantasy']
copies = [120, 80, 60, 90, 70]
plt.bar(books, copies , color ='red')
plt.xlabel ("Books Genre")
plt.ylabel ("No. of Copies Sold")
plt. tle ("Books Sold by Genre")
plt.show ()
Question 4: Scatter Plot
import matplotlib . pyplot as plt
height = [170,180,175,160,165,185]
weight = [65,80,75,55,60,90]
plt.sca er( height,weight,color ='red')
plt.xlabel ("Height(in cms)")
plt.ylabel ("Weight(in kgs)")
plt. tle ("Height-Weight Data")
plt.show ()
Question 5: 3D Scatter Plot
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x= [1,2,3,4,5]
y= [2,3,1,5,4]
z= [3,1,2,4,5]
fig= plt.figure()
ax = fig.add_subplot(111, projec on='3d')
ax.sca er(x,y,z,c='b',marker='o')
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_zlabel('Z Axis')
ax.set_ tle('3D Sca er Plot')
plt.show()
Question 6: 3D Surface Plot
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
x= np.arange(-5,6,1)
y= np.arange(-5,6,1)
x, y= np.meshgrid(x,y)
z= x**2+y**2
fig= plt.figure()
ax = fig.add_subplot(111, projec on='3d')
ax.plot_surface(x,y,z,cmap='viridis')
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_zlabel('Z Axis')
ax.set_ tle('3D Surface Plot')
plt.show()
Question 7: Pie Chart
import matplotlib.pyplot as plt
companies = ['Company A', 'Company B', 'Company C', 'Company D']
market_share = [35, 25, 20, 25]
plt.figure(figsize=(7,7))
plt.pie(market_share, labels=companies, autopct='%1.1f%%', shadow=True,
startangle=140)
plt. tle('Market Share')
plt.show()
Question 8: Histogram
import matplotlib.pyplot as plt
ages = [23, 45, 23, 34, 25, 30, 40, 45, 23, 22, 24, 31, 38, 40, 25, 28, 30, 29, 22,
26]
plt.hist(ages, bins=8, color='red',edgecolor='black')
plt.xlabel('Ages')
plt.ylabel('Frequency')
plt. tle('Age Distribu on')
plt.show()
Question 9: 3D Wireframe Plot
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
x= np.linspace(-5,5,1000)
y= np.linspace(-5,5,1000)
x, y= np.meshgrid(x,y)
z= np.sin(np.sqrt(x**2+y**2))
fig= plt.figure()
ax = fig.add_subplot(111, projec on='3d')
ax.plot_surface(x,y,z,cmap='viridis')
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_zlabel('Z Axis')
ax.set_ tle('3D Wireframe Plot')
plt.show()
Question 10: Annotated Scatter Plot
import matplotlib . pyplot as plt
height = [170,180,175,160,165,185]
weight = [65,80,75,55,60,90]
plt.sca er( height,weight,color ='red')
plt.xlabel ("Height(in cms)")
plt.ylabel ("Weight(in kgs)")
plt. tle ("Height-Weight Data")
for i in range(len(height)):
plt.annotate(f'Person {i + 1}', (height[i], weight[i]), textcoords="offset points",
xytext=(0, 5), ha='center')
plt.show()
You might also like
Cs3353 Foundations of Data Science Unit V
PDF
No ratings yet
Cs3353 Foundations of Data Science Unit V
13 pages
VIT Bhopal University MAT1003 Calculus TEE B21+B22+B23
PDF
No ratings yet
VIT Bhopal University MAT1003 Calculus TEE B21+B22+B23
2 pages
Matplotlib in Python
PDF
No ratings yet
Matplotlib in Python
43 pages
Hands On Data Visualization Using Matplotlib
PDF
100% (1)
Hands On Data Visualization Using Matplotlib
7 pages
ICT582 Topic 11
PDF
No ratings yet
ICT582 Topic 11
35 pages
Python Course Cheat Sheet
PDF
No ratings yet
Python Course Cheat Sheet
30 pages
24-25 Gr-10-Ai Practical File Python Term-1 and Term-2!24!25 2
PDF
No ratings yet
24-25 Gr-10-Ai Practical File Python Term-1 and Term-2!24!25 2
23 pages
VIT Bhopal University MAT1003 Calculus TEE A21+A22+A23
PDF
No ratings yet
VIT Bhopal University MAT1003 Calculus TEE A21+A22+A23
3 pages
Smita ML Labbbb-11-20
PDF
No ratings yet
Smita ML Labbbb-11-20
10 pages
Python Plotting Basics
PDF
No ratings yet
Python Plotting Basics
4 pages
VIT Bhopal University MAT1003 Calculus TEE C11+C12+C13+C14+C15
PDF
No ratings yet
VIT Bhopal University MAT1003 Calculus TEE C11+C12+C13+C14+C15
2 pages
Unit V Anseer Key
PDF
No ratings yet
Unit V Anseer Key
10 pages
Week6 Matplotlib
PDF
No ratings yet
Week6 Matplotlib
5 pages
Cs3353 Foundations of Data Science Unit V 01.12.2022
PDF
No ratings yet
Cs3353 Foundations of Data Science Unit V 01.12.2022
37 pages
Fundamentals of Data Science Lab Manual
PDF
No ratings yet
Fundamentals of Data Science Lab Manual
34 pages
DT Worksheet 03.10
PDF
No ratings yet
DT Worksheet 03.10
14 pages
CLASS1
PDF
No ratings yet
CLASS1
7 pages
VIT Bhopal University MAT1003 Calculus TEE B11+B12+B13
PDF
No ratings yet
VIT Bhopal University MAT1003 Calculus TEE B11+B12+B13
2 pages
Lecture 9 - Data Visualization (Matplotlib)
PDF
No ratings yet
Lecture 9 - Data Visualization (Matplotlib)
26 pages
Presentation REWARDS AND RECOGNITION FINAL
PDF
No ratings yet
Presentation REWARDS AND RECOGNITION FINAL
29 pages
Mat Plot Lib
PDF
No ratings yet
Mat Plot Lib
7 pages
Practical Questions2
PDF
No ratings yet
Practical Questions2
2 pages
How To Add Fields in Standard Report MB51
PDF
100% (1)
How To Add Fields in Standard Report MB51
9 pages
How Can You Create A Histogram in Matplotlib?
PDF
No ratings yet
How Can You Create A Histogram in Matplotlib?
3 pages
RM-Subplots, Scatter Plots and Reading Image - Tutorial
PDF
No ratings yet
RM-Subplots, Scatter Plots and Reading Image - Tutorial
14 pages
AI Lab Record For Class X
PDF
No ratings yet
AI Lab Record For Class X
11 pages
Chapter11 DataVisualization2
PDF
No ratings yet
Chapter11 DataVisualization2
43 pages
Working With Numpy Arrays
PDF
No ratings yet
Working With Numpy Arrays
11 pages
In - Gov.transport VHINSC
PDF
No ratings yet
In - Gov.transport VHINSC
27 pages
Data Visualization
PDF
No ratings yet
Data Visualization
66 pages
Python Unit V Matpoltlib
PDF
No ratings yet
Python Unit V Matpoltlib
12 pages
Matplotlib Functions
PDF
No ratings yet
Matplotlib Functions
32 pages
Matplotlib
PDF
No ratings yet
Matplotlib
7 pages
Data Visualization
PDF
No ratings yet
Data Visualization
28 pages
Matplotlib Python
PDF
No ratings yet
Matplotlib Python
8 pages
Technical Specifications For Construction and Management of SCIF
PDF
100% (1)
Technical Specifications For Construction and Management of SCIF
164 pages
Fods Lab Manual
PDF
No ratings yet
Fods Lab Manual
26 pages
CH 4 Plotting Data Using Mathplotlib 2024-25
PDF
No ratings yet
CH 4 Plotting Data Using Mathplotlib 2024-25
29 pages
Numpy
PDF
No ratings yet
Numpy
13 pages
Unit 5 PythonPackages (Matplotlib)
PDF
No ratings yet
Unit 5 PythonPackages (Matplotlib)
24 pages
Python4 Papia
PDF
No ratings yet
Python4 Papia
18 pages
Vlsi Ieee Project Topics: View Papers
PDF
No ratings yet
Vlsi Ieee Project Topics: View Papers
6 pages
Graphics 2D 3D
PDF
No ratings yet
Graphics 2D 3D
16 pages
Python Basic Plot
PDF
No ratings yet
Python Basic Plot
43 pages
Experiment 9
PDF
No ratings yet
Experiment 9
8 pages
Exp 2 SDK Ok
PDF
No ratings yet
Exp 2 SDK Ok
18 pages
DSP LAB-3 (Part-A)
PDF
No ratings yet
DSP LAB-3 (Part-A)
16 pages
IP Book 12 Question Bank
PDF
No ratings yet
IP Book 12 Question Bank
20 pages
Unit 6 Data Visualization-1
PDF
No ratings yet
Unit 6 Data Visualization-1
30 pages
Matplotlib Assessment
PDF
No ratings yet
Matplotlib Assessment
1 page
Unit 3
PDF
No ratings yet
Unit 3
19 pages
Python Unit IV
PDF
No ratings yet
Python Unit IV
12 pages
Data Science Lab: Matplotlib
PDF
No ratings yet
Data Science Lab: Matplotlib
23 pages
DSV - Module-5 Exercise Problems
PDF
No ratings yet
DSV - Module-5 Exercise Problems
16 pages
FOD Record Sem 1
PDF
No ratings yet
FOD Record Sem 1
25 pages
Python 2.1.4
PDF
No ratings yet
Python 2.1.4
10 pages
Reiki For Beginners
PDF
No ratings yet
Reiki For Beginners
6 pages
Answers 1
PDF
No ratings yet
Answers 1
17 pages
EXP1-siddhant Gupta (23 - SE - 148)
PDF
No ratings yet
EXP1-siddhant Gupta (23 - SE - 148)
17 pages
Hollow Prism Physics Investigatory Project Class 12 CBSE
PDF
75% (4)
Hollow Prism Physics Investigatory Project Class 12 CBSE
11 pages
Lab 10
PDF
No ratings yet
Lab 10
16 pages
Lab Py
PDF
No ratings yet
Lab Py
9 pages
Matplotlib Starter: Import As Import As Import As
PDF
No ratings yet
Matplotlib Starter: Import As Import As Import As
24 pages
UNIT-IV - Matplotlib
PDF
No ratings yet
UNIT-IV - Matplotlib
10 pages
Matplotlib
PDF
No ratings yet
Matplotlib
17 pages
Revision of Ct and Sample Mid Course Test 30-9-2018 Đã Chuyển Đổi
PDF
No ratings yet
Revision of Ct and Sample Mid Course Test 30-9-2018 Đã Chuyển Đổi
14 pages
PSP Presentation
PDF
No ratings yet
PSP Presentation
42 pages
Practical Graph
PDF
No ratings yet
Practical Graph
8 pages
Chapter - 8 OB Motivation Re
PDF
No ratings yet
Chapter - 8 OB Motivation Re
26 pages
Grade 11
PDF
No ratings yet
Grade 11
2 pages
NSTP Modules
PDF
No ratings yet
NSTP Modules
3 pages
Class X Summer Vacations HHW
PDF
No ratings yet
Class X Summer Vacations HHW
6 pages
Assignment 4 On Visualization On Graph With Solution
PDF
No ratings yet
Assignment 4 On Visualization On Graph With Solution
14 pages
Report Hydrology
PDF
No ratings yet
Report Hydrology
56 pages
Question and Answers For Pyplots
PDF
No ratings yet
Question and Answers For Pyplots
11 pages
Handout 2 Machine Learning-Matplotlib and Pandas: Plot Function
PDF
No ratings yet
Handout 2 Machine Learning-Matplotlib and Pandas: Plot Function
5 pages
Aster254 TRG E1
PDF
No ratings yet
Aster254 TRG E1
46 pages
VIT Bhopal University MAT1003 Calculus TEE B11+B12+B13+B14+B15
PDF
No ratings yet
VIT Bhopal University MAT1003 Calculus TEE B11+B12+B13+B14+B15
2 pages
Vsphere Esxi Vcenter Server 60 Appliance Configuration Guide
PDF
No ratings yet
Vsphere Esxi Vcenter Server 60 Appliance Configuration Guide
52 pages
C.W - 2 - Measuring Matter
PDF
No ratings yet
C.W - 2 - Measuring Matter
3 pages
What Is LG3
PDF
No ratings yet
What Is LG3
2 pages
Transmissio Tower Design
PDF
No ratings yet
Transmissio Tower Design
0 pages
Article - Application of Liquidated Damages
PDF
No ratings yet
Article - Application of Liquidated Damages
14 pages
Digital Libraries
PDF
No ratings yet
Digital Libraries
23 pages
Vacuum Arc Remelting
PDF
No ratings yet
Vacuum Arc Remelting
8 pages
3d Printing Handout
PDF
No ratings yet
3d Printing Handout
3 pages
Q2 2
PDF
No ratings yet
Q2 2
2 pages
Young's Modulus
PDF
No ratings yet
Young's Modulus
5 pages
De Revolutionibus Orbium Coelestium
PDF
No ratings yet
De Revolutionibus Orbium Coelestium
8 pages
Using MIS 5e International Edition: MIS in Business by David Kroenke
PDF
No ratings yet
Using MIS 5e International Edition: MIS in Business by David Kroenke
37 pages
Bio Data Name: Prof. Dr. Vinod Kapoor Date/ Place of Birth Educational Qualifications
PDF
No ratings yet
Bio Data Name: Prof. Dr. Vinod Kapoor Date/ Place of Birth Educational Qualifications
6 pages
SBI Clerk Mains Result 2016 Declared!!!
PDF
No ratings yet
SBI Clerk Mains Result 2016 Declared!!!
9 pages
Case Analysis 3. MR Raos Confusion
PDF
No ratings yet
Case Analysis 3. MR Raos Confusion
10 pages
The Asian Efficiency Way To Implement A 12 Week Year: Transcripts
PDF
100% (7)
The Asian Efficiency Way To Implement A 12 Week Year: Transcripts
8 pages
The Critical Review Essay
PDF
No ratings yet
The Critical Review Essay
1 page
Analytic Geometry: Graphic Solutions Using Matlab Language
From Everand
Analytic Geometry: Graphic Solutions Using Matlab Language
Ing. Mario Castillo
No ratings yet