-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creted seperated folder for plotting
- Loading branch information
Akshay Patil
committed
Mar 12, 2018
1 parent
b2e6a88
commit 466e450
Showing
10 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Male count: 57802 | ||
Female count: 27042 | ||
Not Classified: 62794 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import sqlite3 | ||
import matplotlib.pyplot as plt | ||
|
||
db = sqlite3.connect('../commentsData.db') | ||
|
||
c = db.cursor() | ||
|
||
c.execute("select C.userID, count(distinct C.assetURL) as artCount from comments C, commenterGender CG where C.userID = CG.userID and CG.gender = 'female' group by C.userID order by artCount desc;") | ||
|
||
print "queruy exec'ed" | ||
fuserids = [] | ||
farticlesCount = [] | ||
|
||
for t in c.fetchall(): | ||
fuserids.append(t[0]) | ||
farticlesCount.append(t[1]) | ||
|
||
pos = range(len(fuserids)) | ||
print max(farticlesCount) | ||
|
||
plt.plot(pos, farticlesCount, marker = '.', linewidth = 0, color = 'red', label = 'Female') | ||
|
||
|
||
c.execute("select C.userID, count(distinct C.assetURL) as artCount from comments C, commenterGender CG where C.userID = CG.userID and CG.gender = 'male' group by C.userID order by artCount desc;") | ||
|
||
muserids = [] | ||
marticlesCount = [] | ||
|
||
for t in c.fetchall(): | ||
muserids.append(t[0]) | ||
marticlesCount.append(t[1]) | ||
|
||
pos = range(len(muserids)) | ||
print max(marticlesCount) | ||
|
||
plt.plot(pos, marticlesCount, marker = '.', linewidth = 0, color = 'blue', label = 'Male') | ||
|
||
|
||
#rect1 = plt.bar(pos, secCount, align= 'center') | ||
plt.ylabel('No of Articles') | ||
plt.xlabel('Commenters') | ||
plt.legend() | ||
plt.title('Articles Distribution over Male and Female Commenters') | ||
#plt.xticks(pos, userids) | ||
plt.xticks(rotation=0) | ||
|
||
|
||
|
||
|
||
plt.show() | ||
#plt.savefig('commentsDistribution.png', bbox_inches='tight') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sqlite3 | ||
import matplotlib.pyplot as plt | ||
|
||
db = sqlite3.connect('../commentsData.db') | ||
|
||
c = db.cursor() | ||
|
||
c.execute("select section, count(*) as 'Count' from ArticleSection GROUP BY section ORDER BY Count") | ||
|
||
sections = [] | ||
secCount = [] | ||
|
||
for t in c.fetchall(): | ||
sections.append(t[0]) | ||
secCount.append(t[1]) | ||
|
||
|
||
|
||
pos = range(len(sections)) | ||
print max(secCount) | ||
|
||
rect1 = plt.bar(pos, secCount, align= 'center') | ||
plt.ylabel('No of Articles') | ||
plt.xlabel('Section Names') | ||
plt.title('Section Distribution over Articles') | ||
plt.xticks(pos, sections) | ||
plt.xticks(rotation=90) | ||
|
||
def autolabel(rects): | ||
# attach some text labels | ||
for rect in rects: | ||
height = rect.get_height() | ||
plt.text(rect.get_x()+rect.get_width()/2., 1.01*height, '%d'%int(height), | ||
ha='center', va='bottom', rotation = 90) | ||
|
||
autolabel(rect1) | ||
|
||
|
||
plt.show() | ||
#plt.savefig("SectionDistibution.png", bbox_inches='tight') |