示例#1
0
    plt.rcParams["figure.figsize"] = (30, 40)
    plt.rc("font", size=18)
    plt.rc("axes", titlesize=25)
    plt.rc("axes", labelsize=22)
    plt.rc("xtick", labelsize=20)
    plt.rc("ytick", labelsize=20)
    plt.rc("legend", fontsize=30)
    plt.rc("figure", titlesize=50)
    plt.rcParams["font.family"] = "Humor Sans"


if __name__ == "__main__":
    configure_matplotlib()
    from chatviz.utils import load_example_chat_data

    df = load_example_chat_data()
    actors = [
        "John Cleese",
        "Eric Idle",
        "Michael Palin",
        "Terry Jones",
        "Graham Chapman",
    ]
    palette = ["#20639B", "#3CAEA3", "#F6D55C", "#ED553B", "#173F5F"]
    colors = {n: c for (n, c) in zip(actors, palette)}

    visualize_chat(
        df,
        title="Monty Python Flying Circus: Series 1",
        colors=colors,
        stopwords=STOPWORDS,
示例#2
0
def generate_dummy_data(n_members=5):
    df = load_example_chat_data()
    # file_path = pathlib.Path(__file__) / ".." / "test_data" / "series_1.csv"
    # df = pd.read_csv(file_path.resolve(), index_col=0, parse_dates=["date"])
    members = list(df["name"].value_counts().index)
    return df[df["name"].isin(members[:n_members])]