Skip to content

Commit

Permalink
calling function is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Aadit-Bhojgi committed Apr 28, 2017
1 parent 57f3a35 commit 279b716
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions stat_1.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@

def calstat():
import matplotlib
import utils

matplotlib.use('Qt4Agg')
from matplotlib import pyplot as plt
vert = hori = 0
with open('movefile.txt', 'r') as in_file:
for line in in_file:
if line[0] == '1':
vert += 1
else:
hori += 1
import matplotlib
import utils

# Pie chart, where the slices will be ordered and plotted counter-clockwise:
labels = 'Vertical Moves', 'Horizontal Moves'
sizes = [vert, hori]
explode = (0, 0.1)
matplotlib.use('Qt4Agg')
from matplotlib import pyplot as plt
vert = hori = 0
with open('movefile.txt', 'r') as in_file:
for line in in_file:
if line[0] == '1':
vert += 1
else:
hori += 1

fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
shadow=True, startangle=90)
ax1.axis('equal') # Equal aspect ratio ensures that pie chart is drawn as a circle.
plt.show()
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
labels = 'Vertical Moves', 'Horizontal Moves'
sizes = [vert, hori]
explode = (0, 0.1)

fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
shadow=True, startangle=90)
ax1.axis('equal') # Equal aspect ratio ensures that pie chart is drawn as a circle.
plt.show()
calstat()

0 comments on commit 279b716

Please sign in to comment.