def hist_number_of_words(nfvs): total = len(nfvs) nwords = [x['note_words'] for x in nfvs.values()] stats = s(nwords) cap.hist2( nwords, breaks=[ 0, 1, 5, 10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000, 10000 ], filename="/var/www/listit-study/n-words.png", xlab="number of words", title= "words per note [df:%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total - 1, stats[1], stats[2], stats[3], stats[4]), ylab="Notes (out of %d)" % total) cap.loghist( nwords, breaks=[ 0, 1, 5, 10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000, 10000 ], filename="/var/www/listit-study/n-logwords.png", xlab="number of words", title= "words per note [df:%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total - 1, stats[1], stats[2], stats[3], stats[4]), ylab="Notes (out of %d)" % total)
def hist_notes_per_user( npu=None, breaks=[0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 500], notevals=None): print "NUMBER OF OWNERS: %d " % len(npu["notes"]) total = len(npu["notes"]) print total if not npu: npu = notes_per_user(notevals) print "%%%%%%%%%%%%%%" print npu["percent_kept"] print "%%%%%%%%%%%%%%" cap.hist2(npu["notes"], breaks=breaks, filename="/var/www/listit-study/n.png", xlab="# notes", title="Number of notes created by users", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["deleted"], breaks=breaks, filename="/var/www/listit-study/n-deleted.png", xlab="# deleted", title="Number of notes deleted", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["notdeleted"], breaks=breaks, filename="/var/www/listit-study/n-not-deleted.png", xlab="Number of notes kept", title="Number of notes kept", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["percent_kept"], breaks=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], filename="/var/www/listit-study/n-percentage-kept.png", xlab="% kept", title="Percentage of notes kept", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["percent_deleted"], breaks=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], filename="/var/www/listit-study/n-percentage-deleted.png", breaklabels=[ "0-10%", "10-20%", "20-30%", "30-40%", "40-50%", "50-60%", "60-70%", "70-80%", "80-90%", "90-100%" ], xlab="% deleted", title="Percentage of notes deleted", ylab="Users (out of %d)" % total)
def hist_edits(nfs): total = len(nfs) ndist = [n["note_edits"] for n in nfs.values()] stats = s(ndist) cap.hist2( ndist, breaks=[0,1,5,10,20,30,40,50,100,200,500,1000,10000], filename="/var/www/listit-study/n-edits.png", xlab="# of edits per note", title="note edits[%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total-1,stats[1],stats[2],stats[3],stats[4]), ylab="notes (out of %d)" % total )
def hist_edits(nfs): total = len(nfs) ndist = [n["note_edits"] for n in nfs.values()] stats = s(ndist) cap.hist2( ndist, breaks=[0, 1, 5, 10, 20, 30, 40, 50, 100, 200, 500, 1000, 10000], filename="/var/www/listit-study/n-edits.png", xlab="# of edits per note", title="note edits[%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total - 1, stats[1], stats[2], stats[3], stats[4]), ylab="notes (out of %d)" % total)
def hist_capped_number_of_words(nfvs,cap=300): total = len(nfvs) nwords = [x['note_words'] for x in nfvs.values() if x['note_words'] < cap] stats = s(nwords) cap.hist2( nwords, breaks=[0,1,5,10,20,30,40,50,100,200,300], filename="/var/www/listit-study/n-words.png", xlab="number of words", title="words per note [df:%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total-1,stats[1],stats[2],stats[3],stats[4]), ylab="Notes (out of %d)" % total ) cap.loghist( nwords, breaks=[0,1,5,10,20,30,40,50,100,200,500,1000,2000,5000,10000], filename="/var/www/listit-study/n-logwords.png", xlab="number of words", title="words per note [df:%d] (min:0, max:%g, mean:%g, median:%g, var:%g)" % (total-1,stats[1],stats[2],stats[3],stats[4]), ylab="Notes (out of %d)" % total )
def hist_notes_per_user(npu=None,breaks=[0,20,30,40,50,60,70,80,90,100,150,200,500],notevals=None): print "NUMBER OF OWNERS: %d " % len(npu["notes"]) total = len(npu["notes"]) print total if not npu: npu = notes_per_user(notevals) print "%%%%%%%%%%%%%%" print npu["percent_kept"] print "%%%%%%%%%%%%%%" cap.hist2(npu["notes"],breaks=breaks,filename="/var/www/listit-study/n.png", xlab="# notes", title="Number of notes created by users", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["deleted"],breaks=breaks,filename="/var/www/listit-study/n-deleted.png", xlab="# deleted", title="Number of notes deleted", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["notdeleted"],breaks=breaks,filename="/var/www/listit-study/n-not-deleted.png", xlab="Number of notes kept", title="Number of notes kept", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["percent_kept"], breaks=[0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0],filename="/var/www/listit-study/n-percentage-kept.png", xlab="% kept", title="Percentage of notes kept", ylab="Users (out of %d)" % total) # ylim=r.c(0,total)) cap.hist2(npu["percent_deleted"], breaks=[0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0],filename="/var/www/listit-study/n-percentage-deleted.png", breaklabels=["0-10%","10-20%","20-30%","30-40%","40-50%","50-60%","60-70%","70-80%","80-90%","90-100%"], xlab="% deleted", title="Percentage of notes deleted", ylab="Users (out of %d)" % total)