cellyzer/visualization.py
def active_time_bar_chart(time_dict, gui=False, user='xxx', dataset_id='1'):
    """
    Generates a bar chart of the active time of a given user.
    X-axis represents the time(hour of the day)
    Y-axis number of records
    :param time_dict: Dictionary of hour and activities as key,value pairs
    :param user: Given User
    :return: None, visualizes the chart in a web page
    """
    fig_id = user + dataset_id
    plt.figure(fig_id)
    hours = []
    activity = []
    for key, value in time_dict.items():
        hours.append(key)
        activity.append(value)

    y_pos = np.arange(len(hours))
    plt.bar(y_pos, activity, align='center', alpha=0.9)
    plt.xticks(y_pos, hours, fontsize=6)
    plt.ylabel("Activity", fontsize=8)
    plt.xlabel("Hours", fontsize=8)
    plt.title("Most active times during day - user: " + user, fontsize=8)

    tmpfile = BytesIO()
    plt.savefig(tmpfile, format='png')
    encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8')
    html = '<div>' + '<img src=\'data:image/png;base64,{}\'>'.format(encoded) + '</div>'
    with open('outputs\\active_time_bar_chart.html', 'w') as f:
        f.write(html)
    webbrowser.open("outputs\\active_time_bar_chart.html")

    Generates a bar chart of the active time of a given user.
    X-axis represents the time(hour of the day)
    Y-axis number of records
    :param time_dict: Dictionary of hour and activities as key,value pairs
    :param user: Given User
    :return: None, visualizes the chart in a web page
    
Generates a bar chart of the active time of a given user.
X-axis represents the time(hour of the day)
Y-axis number of records
Generates a bar chart of the active time of a given user . X - axis represents the time ( hour of the day ) Y - axis number of records
def active_time_bar_chart(time_dict, gui=False, user='xxx', dataset_id='1'):
    fig_id = user + dataset_id
    plt.figure(fig_id)
    hours = []
    activity = []
    for key, value in time_dict.items():
        hours.append(key)
        activity.append(value)
    y_pos = np.arange(len(hours))
    plt.bar(y_pos, activity, align='center', alpha=0.9)
    plt.xticks(y_pos, hours, fontsize=6)
    plt.ylabel("Activity", fontsize=8)
    plt.xlabel("Hours", fontsize=8)
    plt.title("Most active times during day - user: " + user, fontsize=8)
    tmpfile = BytesIO()
    plt.savefig(tmpfile, format='png')
    encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8')
    html = '<div>' + '<img src=\'data:image/png;base64,{}\'>'.format(encoded) + '</div>'
    with open('outputs\\active_time_bar_chart.html', 'w') as f:
        f.write(html)
    webbrowser.open("outputs\\active_time_bar_chart.html")
def active_time_bar_chart ( time_dict , gui = False , user = 'xxx' , dataset_id = '1' ) : fig_id = user + dataset_id plt . figure ( fig_id ) hours = [ ] activity = [ ] for key , value in time_dict . items ( ) : hours . append ( key ) activity . append ( value ) y_pos = np . arange ( len ( hours ) ) plt . bar ( y_pos , activity , align = 'center' , alpha = 0.9 ) plt . xticks ( y_pos , hours , fontsize = 6 ) plt . ylabel ( "Activity" , fontsize = 8 ) plt . xlabel ( "Hours" , fontsize = 8 ) plt . title ( "Most active times during day - user: " + user , fontsize = 8 ) tmpfile = BytesIO ( ) plt . savefig ( tmpfile , format = 'png' ) encoded = base64 . b64encode ( tmpfile . getvalue ( ) ) . decode ( 'utf-8' ) html = '<div>' + '<img src=\'data:image/png;base64,{}\'>' . format ( encoded ) + '</div>' with open ( 'outputs\\active_time_bar_chart.html' , 'w' ) as f : f . write ( html ) webbrowser . open ( "outputs\\active_time_bar_chart.html" )
Generates a bar chart of the active time of a given user.
Generates a bar chart of the active time of a given user .
"""
    Generates a bar chart of the active time of a given user.
    X-axis represents the time(hour of the day)
    Y-axis number of records
    :param time_dict: Dictionary of hour and activities as key,value pairs
    :param user: Given User
    :return: None, visualizes the chart in a web page
    """
None, visualizes the chart in a web page
None visualizes the chart in a web page
time_dict
Dictionary of hour and activities as key,value pairs
Dictionary of hour and activities as key value pairs
gui
user
None
dataset_id