Skip to content

Commit 52fa04b

Browse files
committed
slightly better graphs
1 parent ddfad32 commit 52fa04b

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.scripts/git/pre-commit/analyze

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ def getProblemList():
1717

1818
def plot( data, title, filename ):
1919
mean = np.average( data )
20+
median = np.median( data )
21+
mode = max( np.histogram( data )[1] )
2022
bins = np.linspace(math.ceil(min(data)),math.floor(max(data)),20)
2123
plt.xlim([min(data), max(data)])
2224
plt.hist(data, bins=bins, alpha=0.5)
23-
plt.axvline( mean, color='k', linestyle='dashed', linewidth=1 )
25+
plt.axvline( mean, color='r', linestyle='dashed', linewidth=1, marker='^' )
26+
plt.axvline( median, color='g', linestyle='dashed', linewidth=1, marker='s' )
27+
plt.axvline( mode, color='b', linestyle='dashed', linewidth=1, marker='o' )
2428
min_ylim, max_ylim = plt.ylim()
25-
plt.text( mean * 1.1, max_ylim * 0.9, 'Mean: {:.2f}'.format( mean ) )
29+
plt.text( mean, max_ylim * 0.33, 'Mean: {:.2f}'.format( mean ), color='r', rotation=270 )
30+
plt.text( median, max_ylim * 0.66, 'Median: {:.2f}'.format( median ), color='g', rotation=270 )
31+
plt.text( mode, max_ylim * 0.90, 'Mode: {:.2f}'.format( mode ), color='b', rotation=270 )
2632
plt.title( title )
2733
plt.xlabel( 'percentile' )
2834
plt.ylabel( '# results' )

.scripts/space-rank.png

3.98 KB
Loading

.scripts/time-rank.png

5.48 KB
Loading

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66

77
# leetcode
88
Collection of solutions for problems at https://leetcode.com/
9+
10+
![Time Rank](https://raw.githubusercontent.com/cfriedt/leetcode/master/.scripts/time-rank.png)
11+
12+
![Space Rank](https://raw.githubusercontent.com/cfriedt/leetcode/master/.scripts/space-rank.png)

0 commit comments

Comments
 (0)