Ejemplo n.º 1
0
    def skill(self, path='', threshold=15):
        """Draws graph of mean skill and mean response time per session.

        :param threshold: how many sessions to draw -- default is 10
        :param path: output directory -- default is '' (current_dir)
        """

        if not path:
            path = self.current_dir+'/graphs/'
        data = analysis.mean_skill_session(self.frame,self.difficulties,threshold)[0]

        if not data.empty:
            fig, ax = plt.subplots()
            ind = arange(len(data.index))
            width=0.4

            ax.bar(ind+width/2,data.values,width=width, color="green")
            ax.set_title(u"Progress of skill over sessions")
            
            ax.set_xticklabels(ind)
            ax.set_xticks(ind+width)
            ax.set_xlabel('Session number')
            
            ax.set_ylabel('Mean success rate', color='green')
            #ax.yaxis.set_major_formatter(FuncFormatter(lambda x,y: "%1.2f%%"%(100*x))) #sets y-axis to show percentages
            for tl in ax.get_yticklabels():
                tl.set_color('green')

            plt.savefig(path+'skill.svg', bbox_inches='tight') 
            plt.close()        
Ejemplo n.º 2
0
    def skill(self, binning_function=None, path="", number_of_bins=6):
        """Draws map of skill per country.
    
        :param binning_function: which function to use for binning -- default is None (-> jenks_classification)
        :param path: output directory -- default is '' (current dir)
        :param number_of_bins: how many bins to divide data into-- default is 6
        """

        if not path:
            path = self.current_dir + "/maps/"
        data = analysis.mean_skill_session(self.frame, self.difficulties, threshold=None)[1]
        data = analysis.success_probabilities(data, self.difficulties)
        colours = None

        if not data.empty:
            (data, colours) = self.bin_data(data, binning_function, number_of_bins, colour_range="RdYlGn")
            self.generate_css(data[["country", "rgb"]], path=self.current_dir + "/style.css")

        self.draw_map(path + "skill.svg", "Skill ", colours)