b_patch = mpatches.Patch(color="b",
                             label=a_description + " (total: " +
                             str(len(a_scores_a1)) + ", " +
                             str(len(a_scores)) + ")")
    g_patch = mpatches.Patch(color="g",
                             label=b_description + " (total: "  +
                             str(len(b_scores_a1)) + ", " +
                             str(len(b_scores)) + ")")
    plt.legend(handles=[b_patch, g_patch])

    filename = str(a_description) + " vs " + str(b_description) + ".png"
    plt.savefig(filename, bbox_inches="tight")
    print('Created chart "' + filename + '"')

# get all groups of users that we want to compare
everyone = corpus.iter_users()
admins = corpus.iter_users(lambda u: u.meta["is-admin"])
nonadmins = everyone - admins

# do users on the whole coordinate more to admins or nonadmins?
make_chart(
    coord.score(corpus, everyone, admins, focus="targets", target_thresh=7,
        split_by_attribs=split),
    coord.score(corpus, everyone, nonadmins, focus="targets", target_thresh=7,
        split_by_attribs=split),
    "Target: admins", "Target: nonadmins"
)
# do admins coordinate to other people more than nonadmins do?
make_chart(
    coord.score(corpus, admins, everyone, speaker_thresh=7, target_thresh=7,
        split_by_attribs=split),
    b_patch = mpatches.Patch(color="b",
                             label=a_description + " (total: " +
                             str(len(a_scores_a1)) + ", " +
                             str(len(a_scores)) + ")")
    g_patch = mpatches.Patch(color="g",
                             label=b_description + " (total: "  +
                             str(len(b_scores_a1)) + ", " +
                             str(len(b_scores)) + ")")
    plt.legend(handles=[b_patch, g_patch])

    filename = str(a_description) + " vs " + str(b_description) + ".png"
    plt.savefig(filename, bbox_inches="tight")
    print('Created chart "' + filename + '"')

# get all groups of users that we want to compare
everyone = corpus.iter_users()
justices = corpus.iter_users(lambda u: u.meta["is-justice"])
lawyers = corpus.iter_users(lambda u: not u.meta["is-justice"])

# do lawyers coordinate more to justices than the other way around?
make_chart(
    coord.score(corpus, justices, lawyers, target_thresh=6,
        split_by_attribs=split),
    coord.score(corpus, lawyers, justices, target_thresh=6,
        split_by_attribs=split),
    "Justices to lawyers", "Lawyers to justices", "g", "b"
)
# do lawyers coordinate more to unfavorable or favorable justices?
make_chart(
    coord.score(corpus, lawyers, justices, focus="targets", target_thresh=6,
        speaker_thresh=6, split_by_attribs=split,