Iranian_University_Entrance_Exam_-_Applicants_and_Admissions_-_1379_1392_SH.svg


Summary

Description
فارسی: تعداد داوطلبان و پذیرفته‌شدگان کنکور سراسری ایران بین سال‌های 1379 تا 1392
Date
Source Own work
Author دالبا
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import os

import numpy as np
import matplotlib.pyplot as plt

# from http://www.farsnews.com/newstext.php?nn=13930201000641
rawdata = """
1379		1186649		151943		80/12	
1380		1253529		170702		62/13	
1381		1291471		195281		12/15	
1382		1399943		230339		72/17	
1383		1283737		248646		37/19	
1384		1229301		295866		87/23	
1385		1189787		418855		30/35	
1386		1140648		507194		47/44	
1387		1197771		437069		49/36	
1388		1099145		526803		93/47	
1389		1109190		517068		62/46	
1390		994181		608732		23/61	
1391		929801		588610		30/63	
1392		921386		533115		67/56
"""

splitted_data = rawdata.split()
years = np.array([int(y) for y in splitted_data[::4]])
applicants = [int(a) for a in splitted_data[1::4]]
admissions = [int(a) for a in splitted_data[2::4]]

fig = plt.figure()
ax = fig.add_subplot(111)

plt.style.use('ggplot')

axistexts = ax.set_xticklabels([str(y) for y in years])

plt.setp(axistexts, rotation=-45, fontsize=10, clip_on=False)
plt.tick_params(
    axis='x',          # changes apply to the x-axis
    which='both',      # both major and minor ticks are affected
    bottom='off',      # ticks along the bottom edge are off
    top='off',         # ticks along the top edge are off
    labelbottom='on',  # labels along the bottom edge are off
)

plt.xlim(years[0] - .5, years[-1] + 1.2)
plt.xticks(years + .5, years)
max_applicants = max(applicants)
plt.ylim(0, max_applicants + 50000)
plt.yticks(
    range(0, max_applicants + 100000, 100000),
    list(format(i, ',') for i in range(0, max_applicants + 100000, 100000)),
)
plt.ylabel('Applicants / Admissions')

plt.bar(years, applicants, facecolor='#99CCFF')
plt.bar(years, admissions, facecolor='#83FF83')

ax.legend(['Applicants', 'Admissions'])
for y, ap, ad in zip(years ,applicants, admissions):
    plt.text(
        y + .5,
        ad/2,
        format(ad/ap, '.1%'),
        ha='center',
        va= 'center',
        rotation='-45',
    )

plt.savefig(
    os.path.basename(__file__).replace('.py', '.svg')
)
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

11 December 2014