HOW TO CREATE GRAPHS USING PYTHON

HOW TO CREATE GRAPHS USING PYTHON






    

Typically, a graph is depicted in diagrammatic form as a set of dots or circles for the vertices, joined by lines or curves for the edges. Graphs are one of the objects of study in discrete mathematics. The edges may be directed or undirected. For example, if the vertices represent people at a party, and there is an edge between two people if they shake hands, then this graph is undirected because any person A can shake hands with a person B only if B also shakes hands with A. In contrast, if any edge from a person A to a person B corresponds to A owes money to B, then this graph is directed, because owing money is not necessarily reciprocated. The former type of graph is called an undirected graph while the latter type of graph is called a directed graph.n mathematics, and more specifically in graph theory, a graph is a structure amounting to a set of objects in which some pairs of the objects are in some sense "related". The objects correspond to mathematical abstractions called vertices (also called nodes or points) and each of the related pairs of vertices is called an edge . Typically, a graph is depicted in diagrammatic form as a set of dots or circles for the vertices, joined by lines or curves for the edges. Graphs are one of the objects of study in discrete mathematics.

making graph using python is very exciting and fascinating :-

OPEN PYTHON IDE


TYPE THE FOLLOWING CODE:-

# we will make the graph of poower of 2 upto 10


import matplotlib.pyplot as plt     #import the module


x = []

y = []


for i in range(1,11):               #for making the power upto 10

    x.append(i)                     #to be append on the empty list of x


for i in range(1,11):

    y.append(pow(2,i))


print(x)

print(y)


#now plot the graph


plt.title('Graph : power of 2')

plt.xlabel('x : 1 to 10')

plt.ylabel('power of 2 for corresponding x')

plt.plot(x,y)

plt.show()



TO DOWNOAD THE PYTHON FILE CLICK HERE

FOR FULL TUTORIAL VIDEO CLICK HERE






Comments

Popular posts from this blog

MAKING CALCULATOR USING PYTHON PROGRAMMING

IPHONE 14 FULL REVIEW

HOW TO CREATE TIC TAC TOE GAME USING PYTHON