0% found this document useful (0 votes)
26 views5 pages

Matplot Lib Programs New

The document contains multiple Python programs that utilize the Matplotlib library to create various types of charts and graphs, including bar charts and line graphs. Each program demonstrates different functionalities such as customizing colors, labels, and legends for visual representation of data. The examples cover plotting logarithmic values, student marks, and mathematical equations.

Uploaded by

NEEMA GANDHI
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)
26 views5 pages

Matplot Lib Programs New

The document contains multiple Python programs that utilize the Matplotlib library to create various types of charts and graphs, including bar charts and line graphs. Each program demonstrates different functionalities such as customizing colors, labels, and legends for visual representation of data. The examples cover plotting logarithmic values, student marks, and mathematical equations.

Uploaded by

NEEMA GANDHI
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

#program 1

#bar chart
import [Link] as p
import numpy as n
a=range(1,11)
b=[Link](a)
[Link](-4,12)
[Link](a,b)
[Link]("Values")
[Link]("Logrithm values")
[Link]()
OUTPUT:

#PROGRAM 2
import [Link] as p
names=['Abhi','Ami','Ritu','Ramit']
marks=[225,245,250,234]
[Link](names,marks)
[Link]("Student's Names")
[Link]("Total Marks")
[Link]()
OUTPUT:

#Program 3
import [Link] as p
names=['Abhi','Ami','Ritu','Ramit']
marks=[225,245,250,234]
[Link](150,350)
[Link](names,marks,color=['r','b','g','y'],width=[1,0.5,0.7,0.25])
[Link]("Student's Names")
[Link]("Total Marks")
[Link]()
[Link]()
Output:

Program 4
import [Link] as p
import numpy as n
info=['Gold','Silver','Bronze']
India=[22,20,30]
Australia=[45,35,40]
England=[26,27,34]
Canada=[34,45,46]
x=[Link](len(info))
[Link](info,India,width=.15,label='India')
[Link](x+.15,Australia,width=.15,label='Australia')
[Link](x+.30,England,width=.15,label='England')
[Link](x+.45,Canada,width=.15,label='Canada')
[Link]("Medal type")
[Link]("Medal Count")
[Link]()
[Link]()
OUTPUT:
#program 5
# importing required modules
import [Link] as plt
# values of x and y axes
x = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
y = [1, 4, 3, 2, 7, 6, 9, 8, 10, 5]
[Link](x, y)
[Link]('x')
[Link]('y')
[Link]()

output:

#Program 6
# importing libraries
import [Link] as plt
import numpy as np
# values of x and y axes
x = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
y = [1, 4, 3, 2, 7, 6, 9, 8, 10, 5]
[Link](x, y, 'b')
[Link]('x')
[Link]('y')
# 0 is the initial value, 51 is the final value
# (last value is not taken) and 5 is the difference
# of values between two consecutive ticks
[Link]([Link](0, 51, 5))
[Link]([Link](0, 11, 1))
[Link]()
output:
Program – 7
# to draw a line graph for y=4x+3
import numpy as np
import [Link] as mp
x=[Link](0,10,2)
y=4*x+3
[Link](x,y,color='r',linestyle="dashed")
[Link]("X-axis")
[Link]("Y-axis")
[Link]("Equation : y= 4x+3")
[Link]()

Program 8
import numpy as np
import [Link] as mp
a=[Link](1,20,2)
b=a*10+2
c=[Link](a)
[Link]("number")
[Link]("Value")
[Link]("Graph or Chart")
[Link](a,b)
[Link](a,c)
[Link]()
output:

Program 9
import [Link] as m

x=['Ruhi','Rani','Ramit','Abhi']
y=[34,45,44,34]
[Link](x,y,'c',linestyle='dashed', marker='d',markersize=5, markeredgecolor='red')
[Link]("Student's Name")
[Link]("Marks")
[Link]()

You might also like