In [1]:
import matplotlib.pyplot as plt
import numpy as np

In [2]:
def prepost(prelab, preraw, postlab, postraw, ylabel="Percentage (%)", fname='fig.svg'):
    preraw = np.array(preraw, float)
    npre = len(preraw)
    predat = 100 * preraw / preraw.sum()
    postraw = np.array(postraw, float)
    npost = len(postraw)
    postdat = 100 * postraw / postraw.sum()
    fig = plt.figure(1)
    p = plt.subplot(1, 2, 1)
    plt.bar(range(npre), predat, align='center', fc='r')
    plt.axis([-0.5, npre - 0.5, 0, 100])
    plt.xticks(range(npre), prelab, rotation=90)
    plt.title("(a) Pre-Assesment")
    plt.ylabel(ylabel)
    p = plt.subplot(1, 2, 2)
    plt.bar(range(npost), postdat, align='center', fc='g')
    plt.axis([-0.5, npost - 0.5, 0, 100])
    plt.xticks(range(npost), postlab, rotation=90)
    plt.title("(b) Post-Assesment")
    plt.savefig(fname, bbox_inches="tight")
    plt.show()
    plt.close()

Figure 1


In [3]:
prelab = ["I wouldn't know where to start.", "I could probably struggle with.",
          "I could do easily."]
preraw = [28, 6, 2]
postlab = ["I could not complete.", 
           "I could complete w/ documentation.",
           "I could complete with little help."]
postraw = [16, 26, 4]
prepost(prelab, preraw, postlab, postraw, "Basic Tasks Percentage (%)", 'aims-fig1.svg')



In [4]:
prelab = ["I wouldn't know where to start.", "I could probably struggle with.",
          "I could do easily."]
preraw = [26, 8, 2]
postlab = ["I am not familiar with the shell.",
           "I only know the name of the shell.",
           "I am familiar but have not used it.",
           "I am familiar because I am using it."]
postraw = [2, 7, 10, 28]
prepost(prelab, preraw, postlab, postraw, "Shell Percentage (%)", 'aims-fig2.svg')



In [5]:
prelab = ["I wouldn't know where to start.", "I could probably struggle with.",
          "I could do easily."]
preraw = [26, 10, 0]
postlab = ["I am not familiar with git.",
           "I only know the name 'git'.",
           "I am familiar but have not used git.",
           "I am familiar because I am using git."]
postraw = [10, 11, 14, 11]
prepost(prelab, preraw, postlab, postraw, "Version Control Percentage (%)", 'aims-fig3.svg')



In [5]: