regolith/gradebuilder.py
def plot_letter_grades(self, students_kwargs, scale):
        """Plots the letter grades in a historgram"""
        try:
            import matplotlib.pyplot as plt
        except ImportError:
            return False
        bins = [x[1] for x in scale[::-1]]
        raws = []
        curveds = []
        for skw in students_kwargs.values():
            raws.append(skw['student_letter_grade_raw'])
            curveds.append(skw['student_letter_grade_curved'])
        n = len(raws)
        rfreq = [raws.count(l) for l in bins]
        cfreq = [curveds.count(l) for l in bins]
        width = 1.0
        pos = np.arange(len(bins))
        f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
        ax1.set_xticks(pos + (width / 2))
        ax1.set_xticklabels(bins)
        ax1.set_xlabel('Raw Grade')
        ax1.set_ylabel('Number of Students')
        ax1.bar(pos, rfreq, width, color='yellow')
        ax1.grid(True)
        ax2.set_xticks(pos + (width / 2))
        ax2.set_xticklabels(bins)
        ax2.set_xlabel('Curved Grade')
        ax2.bar(pos, cfreq, width, color='green')
        ax2.grid(True)
        base = os.path.join(self.bldir, 'student-letter-grade-dist')
        plt.savefig(base + '.png', bbox_inches='tight')
        plt.savefig(base + '.eps', bbox_inches='tight')
        return True
Plots the letter grades in a historgram
Plots the letter grades in a historgram
Plots the letter grades in a historgram
def plot_letter_grades(self, students_kwargs, scale):
        try:
            import matplotlib.pyplot as plt
        except ImportError:
            return False
        bins = [x[1] for x in scale[::-1]]
        raws = []
        curveds = []
        for skw in students_kwargs.values():
            raws.append(skw['student_letter_grade_raw'])
            curveds.append(skw['student_letter_grade_curved'])
        n = len(raws)
        rfreq = [raws.count(l) for l in bins]
        cfreq = [curveds.count(l) for l in bins]
        width = 1.0
        pos = np.arange(len(bins))
        f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
        ax1.set_xticks(pos + (width / 2))
        ax1.set_xticklabels(bins)
        ax1.set_xlabel('Raw Grade')
        ax1.set_ylabel('Number of Students')
        ax1.bar(pos, rfreq, width, color='yellow')
        ax1.grid(True)
        ax2.set_xticks(pos + (width / 2))
        ax2.set_xticklabels(bins)
        ax2.set_xlabel('Curved Grade')
        ax2.bar(pos, cfreq, width, color='green')
        ax2.grid(True)
        base = os.path.join(self.bldir, 'student-letter-grade-dist')
        plt.savefig(base + '.png', bbox_inches='tight')
        plt.savefig(base + '.eps', bbox_inches='tight')
        return True
def plot_letter_grades ( self , students_kwargs , scale ) : try : import matplotlib . pyplot as plt except ImportError : return False bins = [ x [ 1 ] for x in scale [ : : - 1 ] ] raws = [ ] curveds = [ ] for skw in students_kwargs . values ( ) : raws . append ( skw [ 'student_letter_grade_raw' ] ) curveds . append ( skw [ 'student_letter_grade_curved' ] ) n = len ( raws ) rfreq = [ raws . count ( l ) for l in bins ] cfreq = [ curveds . count ( l ) for l in bins ] width = 1.0 pos = np . arange ( len ( bins ) ) f , ( ax1 , ax2 ) = plt . subplots ( 1 , 2 , sharey = True ) ax1 . set_xticks ( pos + ( width / 2 ) ) ax1 . set_xticklabels ( bins ) ax1 . set_xlabel ( 'Raw Grade' ) ax1 . set_ylabel ( 'Number of Students' ) ax1 . bar ( pos , rfreq , width , color = 'yellow' ) ax1 . grid ( True ) ax2 . set_xticks ( pos + ( width / 2 ) ) ax2 . set_xticklabels ( bins ) ax2 . set_xlabel ( 'Curved Grade' ) ax2 . bar ( pos , cfreq , width , color = 'green' ) ax2 . grid ( True ) base = os . path . join ( self . bldir , 'student-letter-grade-dist' ) plt . savefig ( base + '.png' , bbox_inches = 'tight' ) plt . savefig ( base + '.eps' , bbox_inches = 'tight' ) return True
Plots the letter grades in a historgram
Plots the letter grades in a historgram
"""Plots the letter grades in a historgram"""
self
students_kwargs
scale