You are on page 1of 27

SILVER OAK SCHOOL

ACADEMIC YEAR: 2020-21

PROJECT REPORT ON

DATA VISUALISATION USING PYTHON

(is it visualisation or visualization)

ROLL NO. : 24

NAME: CHANDRAKSH NARAYAN

CLASS: XII

SUBJECT: INFORMATICS PRACTICES

PROJECT GUIDE:

GARIMA HAZRATI

PGT (INFORMATICS PRACTICES)

1
CERTIFICATE
This is to certify that Master CHANDRAKSH NARAYAN Roll No:__________ has successfully
completed the project work entitled "VISUALISING PEROIDICITY OF ELEMENTS" in the
subject INFORMATICS PRACTICES laid down in the regulations of CBSE for the purpose of Practical
Examination in Class XII to be held in _____________ on______________.

………………
CHANDRAKSH
NARAYAN
(24)

Examiner: ………………
Name: _______________ (Principal Sign)
Signature:
Date:

2
Table of Contents
CERTIFICATE.............................................................................................................................................................2
ACKNOWLEDGEMENT..............................................................................................................................................4
INTRODUCTION........................................................................................................................................................5
INTRO FOR PROJECT ‘TURTLE TROLLS’.....................................................................................................................5
OBJECTIVES OF THE PROJECT...................................................................................................................................5
CODE OF PROGRAM ‘TURTLE TROLLS’.....................................................................................................................6
OUTPUT.................................................................................................................................................................. 12
PROPOSED SYSTEM................................................................................................................................................13
VISUALISING PERIODICITY OF ELEMENTS...............................................................................................................14
Analysis of project: Visualizing Periodicity Of Elements.........................................................................................19
Line plot..................................................................................................................................................................20
BAR Graph..............................................................................................................................................................23
Histogram...............................................................................................................................................................25
References..............................................................................................................................................................27

3
ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any project depends largely on the encouragement and
guidelines of many others. I take this opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.

I express deep sense of gratitude to almighty God for giving me strength for the successful completion
of the project.

I express my heartfelt gratitude to my parents for constant encouragement while carrying out this
project.

I gratefully acknowledge the contribution of the individuals who contributed in bringing this project up
to this level, who continues to look after me despite my flaws, I express my deep sense of gratitude to
the luminary The Principal, Mr. Surendra Yadav who has been continuously motivating and
extending their helping hand to us.

My sincere thanks to Ms Garima Hazrati, Master In-charge, A guide, Mentor all the above a friend,
who critically reviewed my project and helped in solving each and every problem, occurred during
implementation of the project.

The guidance and support received from all the members who contributed and who are contributing to
this project, was vital for the success of the project. I am grateful for their constant support and help.

4
INTRODUCTION
This project named “VISUALISING PEROIDICITY OF ELEMENTS “is created as an effort to
examine my skills and understanding of DATA VISUALISATION on python and using its powerful
assets like NUMPY and PANDAS.
Many students opts science but are not able to understand the patterns and visualize topic of their
textbooks. One of such topic include reoccurrence of elements with similar properties and their
variations along the rows of periodic table. This project is my sincere effort to use python programming
language and its visualization tools to better understand these topic by visualising them.
(plz check intro,spells, anythything extra that make examiner ask me q.)

INTRO FOR PROJECT ‘TURTLE TROLLS’


We have created this project “TURTLE TROLLS” as an experiment purpose to test our knowledge on
python programming, its looping structure, and Turtle module. The game starts as user press the space
button. A user can use 8, 4, 6 for moving forward, turning left and turning right respectively. There is
score calculator which calculates score on the basis of points collected. After a certain score is reached,
program automatically changes the level.
Level 1 is simple as it introduces user to the gaming platform and interface. On level 2, turtle’s speed is
increased along with this there are shooters which can increase turtle’s speed and size and there is
another shooter to vice versa it. Level 3 comes with illusive background where background switches its
color between black and white. Similarly Level 4 too have illusive background but with multicolor
switching. If turtle overlaps with the screen boundary game gets over. As soon as the game is over a
popup window appear asking for username. Thus it records your name along with score you made. This
all happens in real time i.e. once program if closed, score database get reset.

OBJECTIVES OF THE PROJECT


The objective of this project is to apply the programming knowledge into a real- world situation/problem
and exposed how programming skills helps in developing a good software.
1. Write programs utilizing modern software tools.
2. Apply object oriented programming principles effectively when developing small to medium sized
projects.
3. Write effective procedural code to solve small to medium sized problems.
4. Students will demonstrate a breadth of knowledge in information practices, as exemplified in the
areas of systems, theory and software development.
5. Students will demonstrate ability to conduct a research or applied Information Practices project,
requiring writing and presentation skills which exemplify scholarly style in Information Practices

5
CODE OF PROGRAM ‘TURTLE TROLLS’
#main screen code start
import turtle
ktlx=turtle.Screen()
ktlx.setup(height=600,width=800)
ktlx.title("TURTLE TROLLS")
ktl=turtle.Turtle()
ktl.hideturtle()
ktl.pensize(5)
ktl.up()
ktl.goto(-70,0)
ktl.down()
ktl.write("press space bar to start the game")
#main screen code end

def scoreboard(): #Score board function


cur.execute("SELECT * FROM GAME ORDER BY SCORE DESC")
for x in cur:
print(x)

def maingame(): #main game function

#game screen code start


ktlx.clearscreen()
import turtle as ttl
import random

b=ttl.Screen() #game screen


b.bgcolor("lightgreen")

bod=ttl.Turtle() #game screen border line


bod.hideturtle()
bod.pensize(5)
bod.speed(9)
bod.color("white")
bod.up()
bod.setpos(-400,-250)
bod.down()
bod.goto(400,-250)
bod.goto(400,250)
bod.goto(-400,250)

6
bod.goto(-400,-250)

a=ttl.Turtle() #turtle player


a.color("yellow")
a.shape("turtle")
a.speed(0)

c=ttl.Turtle() #food
c.color("red")
c.shape("circle")
c.up()
c.setpos(random.randrange(-350,350),random.randrange(-200,200))
c.down()
c.speed(0)

scosho=ttl.Turtle() #score showing turtle


scosho.hideturtle()
scosho.up()
scosho.setpos(350,270)
scosho.down()
score=[]

levsho=ttl.Turtle() #level showing turtle


levsho.hideturtle()
levsho.up()
levsho.setpos(290,273)
levsho.down()
levsho.write("Level 1")

acc1=ttl.Turtle() #acc. turtle


acc1.speed(0)
acc1.hideturtle()

dcc1=ttl.Turtle() #dcc. turtle


dcc1.speed(0)
dcc1.hideturtle()
#game screen code end

#variables used
i=0
i2=0
li6=["black","white"]

7
li6x=li6[::-1]
li=["lightgreen","blue","orange","magenta","white","purple","yellow","green","cyan","red"]
lix=li[::-1]
speply=3
scorlist=[]

# function for motion


def mar():
a.right(90)

def mal():
a.left(90)

def mu():
a.up()
a.forward(10)
a.down()

#main game loop start


while a.xcor()<370 and a.xcor()>-370 and a.ycor()<220 and a.ycor()>-220:
a.up()
a.forward(speply)
a.down()

if c.distance(a.xcor(),a.ycor())<=25:
c.up()
c.setposition(random.randrange(-300,300),random.randrange(-200,200))
c.down()
score.append(1)
scosho.hideturtle()
scosho.clear()
scosho.color("white")
scosho.begin_fill()
scosho.circle(10,steps=6)
scosho.end_fill()
scosho.color("black")
scosho.write(sum(score))

if sum(score)<6 and sum(score)>4:

acc1.shape("classic")

8
acc1.color("red")
acc1.up()
acc1.setpos(random.randrange(-300,300),random.randrange(-150,150))
acc1.down()
acc1.showturtle()
a.color("orange")
b.bgcolor("yellow")
c.color("red")
speply=9

levsho.undo()
levsho.color("blue")
levsho.write("Level 2")

dcc1.shape("classic")
dcc1.color("green")
dcc1.up()
dcc1.setpos(random.randrange(-300,300),random.randrange(-150,150))
dcc1.down()
dcc1.showturtle()
falspevar=6
continue

if sum(score)<10 and sum(score)>6:


levsho.undo()
levsho.write("Level 3")
a.speed(0)
continue

if sum(score)>10:
levsho.undo()
levsho.write("Level 4")
a.speed(0)
continue

if sum(score)>10:
a.color(lix[i%10])
c.color(lix[i%10])
b.bgcolor(li[i%10])
speply=15
a.speed(10)
i+=1

9
elif sum(score)<10 and sum(score)>6:

a.color(li6[i2%2])
c.color(li6[i2%2])
b.bgcolor(li6x[i2%2])
a.speed(6)
i2+=1
speply=15

if sum(score)>6:
dcc1.up()
dcc1.goto(500,500)
dcc1.down()
acc1.up()
acc1.goto(500,500)
acc1.down()

if sum(score)<6 and sum(score)>4 and acc1.distance(a.xcor(),a.ycor())<=25:


speply=falspevar+5
a.color("red")
a.shapesize(2)
acc1.hideturtle()

if sum(score)<6 and sum(score)>4 and dcc1.distance(a.xcor(),a.ycor())<=25:


speply=falspevar
a.color("orange")
a.shapesize(1)
dcc1.hideturtle()

#main game loop end

#control coding
b.onkeypress(mar,6)
b.onkeypress(mal,4)
b.onkeypress(mu,8)
b.listen()

b.clearscreen()

#coding for game over

10
ktl.write("Score List is reseted after it get closed")
name=ktlx.textinput("SCORE LISTING","Enter your Name:")
ktl.undo()
scorlist.append([name,sum(score)])
print("Your Score:",scorlist)
ktl.up()
ktl.goto(-70,0)
ktl.down()
ktl.write("press space bar to restart the game")
ktlx.onkeypress(maingame,'space')
ktlx.listen()

ktl.up()
ktl.goto(-55,-30)
ktl.down()
ktl.write("press 1 to see score board")
ktlx.onkeypress(scoreboard,'1')
ktlx.listen()

#coding for input

ktlx.onkeypress(maingame,'space')
ktlx.listen()

ktl.up()
ktl.goto(-55,-30)
ktl.down()

ktlx.listen()

11
OUTPUT

Welcome screen

Level 1 and 2

12
Level 3 and 4

Score Listing Dialog Box and Score Boar

PROPOSED SYSTEM

13
Today one cannot afford to rely on the fallible human beings of be really wants to stand against today’s
merciless competition where not to wise saying “to err is human” no longer valid, it’s outdated to
rationalize your mistake. So, to keep pace with time, to bring about the best result without
malfunctioning and greater efficiency so to replace the unending heaps of flies with a much
sophisticated hard disk of the computer.

One has to use the data management software. Software has been an ascent in atomization various
organizations. Many software products working are now in markets, which have helped in making the
organizations work easier and efficiently.

Data management initially had to maintain a lot of ledgers and a lot of paper work has to be done but
now software product on this organization has made their work faster and easier. Now only this software
has to be loaded on the computer and work can be done.

This prevents a lot of time and money. The work becomes fully automated and any information
regarding the organization can be obtained by clicking the button. Moreover, now it’s an age of
computers of and automating such an organization gives the better look.

14
VISUALISING PERIODICITY OF ELEMENTS
CSV stands for Comma Separated Value. CSV file is a delimited test file that uses commas to separate
values. CSV file uses text based format and comma separation to store tabular data. Each line of the file
represents row of tabular format.
CSV files are plain text files, making them easier for the website developers to create. These are easier
to store, import and widely supported by various software. It doesn’t need special editors and can be
edited in notepad. CSV is a safe and can clearly differentiate numeric values and test. It does not
manipulate data and save the data as it is. Importing CSV file is reliable, fast and less memory
consuming. Being a simple text file, it is easy to programmatically manipulate it.
CSV file can be created in any simple text editor (with correct format) and should be saved with
extension .csv or we can use any spreadsheet utility software to fill up data and saving file with
extension with.csv. (check defn)

Create a table in Microsoft Excel

Set filename, browse location and save file CSV format (should I add a ss of saving location too)

15
16
17
18
Analysis of project: Visualizing Periodicity of Elements
NumPy is a Python library used for working with arrays. It also has functions for linear algebra, vectors,
matrices and more. It is a freely available open source project. NumPy stands for Numerical Python.

Pandas is an open-source library, mainly for working with relational or labeled data both easily and
intuitively. It provides various data structures and operations for manipulating numerical data and time
series. This library is used with numpy. Pandas is fast and provide high-performance.

Matplotlib is a visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data
visualization library built on NumPy arrays and designed to work with SciPy. One of the greatest benefits
of visualization is that it allows us visual access to huge amounts of data in easily digestible visuals.
Matplotlib consists of several plots like line, bar, scatter, histogram etc.
IMPORTING ASSETS

We can import our CSV format database using read_csv() command of pandas library. Either we can
use the name of file or specify its path. Here we have assigned our csv file named ‘E.csv’ in a variable
named ‘data’.

Matplotlib offer various visual representations such as LINE PLOT, SCATTER PLOT, BAR GRAPH, HISTOGRAM, PIE
CHART and 3D PLOT etc.

19
Line plot
Line plot represents variation in data over a period by a series of line and curves. It displays information as a
series of data points connected by straight lines.

Line plot is most common and widely used graphical representation to represent data, used in almost every
field. It is used to display change over time or pattern as a series of data points connected by straight line
segments on two axes.

We can easily show the data changes over time over a line graph. It is also helpful to show small changes that
are difficult to measure in other graphs. A relationship between 2 or more variables get identified. It presents a
good impression of trends and changes. Both negative, as well as positive values, are indicated.

use plot () function of


matplotlib.pyplot to
plot a simple line plot. We need to assign data source in plot() function like plt.plot( x-axis, y-axis). We can use
dataframes, series, arrays, list to pass data in plot function.

plt.show() starts an event loop, looks for all currently active figure objects, and opens one or more interactive
windows that display your figure or figures.

Above graph shows Atomic Radii as a function of Atomic no. Every peak in graph represents radius of noble
gases and fall of graph signify atomic radius decreases along the period. Increase in height of these peaks signify
increasing atomic radius down the group.

Here X label is Atomic No. (in amu) and Y label is Atomic Radius (in Å)

X label : The principal or horizontal axis of a system of coordinates, points along which have a value of
zero for all other coordinates. Mostly it represent the quantity with respect to which change is
measured.
Y label : The secondary or vertical axis of a system of coordinates, points along which have a value of
zero for all other coordinates. Mostly it represents the quantity in which the change is measured.

20
Markers are points in line graph used to highlight or emphasize a particular value. We can apply these markers
in our graph using marker attribute of plot() function of matplotlib. We can use various shapes like point, pixel,
circle, star etc.

Above graph shows no. of isotopes in respective periods and these red asterisk marker represents the group of
elements. These markers are useful when difference in the values of data point is large. Since points lying on the
line joining two data points are not useful rather they create confusion of values, but here markers are useful as
they marks the correct position of element.

21
Above graph represents variation in electronegativity over atomic no. Here, by using xticks() function we can
manually assign scale coordinates to x axis. This function works same for y axis.

_____________________________________________________________________________

________________________________________________ could I remove this….it is extra in my project…I e


above expressed the concept________________________________________________________-__

22
Above graph represents both relation between Melting Point and atomic No. and Boiling Point and Atomic No.
Distinguishable line style, colour, marker style and colour are used. We can merge two or more than two graphs
using legend() function of matplotlib.

BAR Graph
A bar graph can be defined as a graphical representation of data, quantities or numbers using bars or strips. Bar
graphs are used to compare and contrast numbers, frequencies or measure different quantities of data. They
can be represented vertically or horizontally along the coordinate axes.

Bar graphs are used to match things between different groups or to trace changes over time. They are easy to
represent and understand, thus are used as an introduction to graphical mathematics for students. They gives us
a rough estimate of change in values or frequencies.

Each bar or column in a barchart is of equal width. All bars have a common base. The height of the bar
corresponds to the value of the data. The distance between each bar is the same.

We use bar() function of matplotlib library to plot bar graph. We assign x and y axis parameter in this function.
We can further graph specific part of document by using the syntax shown above.

Graph below represents the electronegativity of first 10 elements.

23
We can increase the expressibility of our graph to better the understanding of reader. We can use color
attribute of bar function to assign the colour to bar. We can either define colour in string format which is
applicable on all bars or we can define colours in a list to individually assign colour to each bar. In same way we
can also define width of bars by using width function, either by giving a single value or defining it in list. We can
also label our bars using label function. We can also use functions like xlabel() / ylabel(), xticks() / yticks(), title()
defined earlier in this document.

(is this type of para is okay for all command explanation in this doc or I should explain them in more detail with
help of proper syntax)

We can also define two bar plot in a single graph by using legend() function as given below.

Defining two bar plot in a single graph is very useful in analyzing change in multiple functions or values over
change in value of variable or time respectively. It is also helpful analyzing the difference in the values.

24
We can also represent data from any specific position using syntax given in above code.

Histogram
A histogram is a graphical representation that organizes a group of data points into a specified ranges. It is
similar in appearance to a bar graph. The histogram condenses a data series into an easily interpreted visual by
taking many data points and grouping them into logical ranges.

Histogram is used to summarize discrete or continuous data. In other words, it provides a visual interpretation.
This requires focusing on the main points, facts of numerical data by showing the number of data points that fall
within a specified range of values.

A histogram will have bars of equal width, although this is not the case when class intervals vary in size. As you
can see in the example above, the histogram consists simply of a set of vertical bars. Values of the variable being
studied are measured on an arithmetic scale along the horizontal x-axis. The bars are of equal width and
correspond to the equal class intervals, while the height of each bar corresponds to the frequency of the class it
represents.

We can create histogram using hist() function of matplotlib. We need to define the quantity we want to
represent.

25
The above histogram simply represents distribution of number of elements with different melting point given on
x axis. We can further conclude most elements have below 2500 kelvin.

Bins attribute is used to set average value with equal intervals among which our data is distributed. To make our
histogram visually appealing, we can use several functions of hist() function. Histtype is used to set style of
histogram. Color attribute is used to set the colour of bars, edgecolor used to set colour of boundary of bars,
and linewidth is used to set width of boundary. We can even change the orientation of histogram using
orientation attribute.

26
References
Wikipedia
Python documentation
www.w3schools.com
www.geeksforgeeks.org
www.tutorialpoint.com

27

You might also like