Data Visualization Module Document¶
- OpenLA.data_visualization.visualize_grade_distribution(course_info, plot_proportion=False, xlabel=None, ylabel=None, ax=None, figsize=None, fontsize=None, save_file=None)[source]¶
Drow a bar graph of grade distribution in the course.
- Parameters
course_info (CourseInformation) – Instance of CourseInformation class
plot_proportion (bool) – If False, the number of users in each grade is used for Y-axis. If True, the proportion of each grade is used for Y-axis.
xlabel (str) – The label name of x-axis
ylabel (str) – The label name of y-axis
ax (matplotlib.axes.Axes or None) – The axes to plot the figure on. If None, new axes is created
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
- Returns
Bar graph of grade distribution.
- Return type
matplotlib.axes.Axes
- OpenLA.data_visualization.visualize_time_series_graph(event_stream, column, graph_type='line', time_format='%Y/%m/%d %H:%M:%S', xlabel=None, ylabel=None, start_time=None, end_time=None, ax=None, figsize=None, fontsize=None, save_file=None)[source]¶
Draw a time series graph of indicated “column”. If the “save_file” is indicated, the graph is saved.
- Parameters
event_stream (EventStream) – EventStream instance
column – Column to make Y-axis of time series graph
graph_type (str) – The graph type selected from ‘line’, ‘step’, ‘plot’, or ‘bar’
time_format (str) – The time format in x axis. For example, default format ‘%Y/%m/%d %H:%M:%S’ converts “December 10, 2019 at 10:30 p.m.” to “2019/12/10 22:30:00”. The meaning of directive such as ‘%Y’ is in https://docs.python.org/3/library/time.html.
xlabel (str) – The label name of x-axis
ylabel (str) – The label name of y-axis
start_time (pandas.Timestamp or datetime.datetime or None) – The start time of time series
end_time (pandas.Timestamp or datetime.datetime or NOne) – The end time of time series
ax (matplotlib.axes.Axes or None) – The axes to plot the figure on. If None, new axes is created
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
- Returns
The time series graph of selected type
- Return type
matplotlib.axes.Axes
- OpenLA.data_visualization.visualize_operation_count_bar(operation_count, user_id=None, contents_id=None, operation_name=None, calculate_type='total', xlabel=None, ylabel=None, ax=None, figsize=None, fontsize=None, save_file=None)[source]¶
Draw a bar graph which represents each operation used by a specific learner.
- Parameters
operation_count (OperationCount) – OperationCount instance
user_id (str, List[str], or None) – The user id to make graph. If it is None, the graph is made from all users data.
contents_id (str, List[str], or None) – The contents id to make graph. If it is None, the graph is made from all contents data.
operation_name (str, List[str], or None) – The operation name to count. If it is None, the graph is made for all operations.
calculate_type (str) – ‘total’ or ‘average’. How a multiple values integrate.
xlabel (str) – The label name of x-axis
ylabel (str) – The label name of y-axis
ax (matplotlib.axes.Axes or None) – The axes to plot the figure on. If None, new axes is created
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
- Returns
The bar graph
- Return type
matplotlib.axes.Axes
- OpenLA.data_visualization.visualize_behavior_in_pages(pagewise_aggregation, contents_id, user_id=None, is_plot_operation=True, is_plot_reading_time=True, operation_name=None, reading_time_basis='minutes', calculate_type='total', operation_bar_colors=None, reading_time_color='brown', figsize=None, fontsize=None, save_file=None)[source]¶
Draw a bar graph which represents page-wise counting result of each operation and reading time.
- Parameters
pagewise_aggregation (PageWiseAggregation) – The instance of PageWiseAggregation
contents_id (str) – The contents id to make graph. If it is None, the graph is made from all contents data.
user_id (str, List[str], or None) – The user id to make graph. If it is None, the graph is made from all users data.
is_plot_operation (bool) – Whether make a bar plot of operation count
is_plot_reading_time (bool) – Whether make a bar plot of reading time
operation_name (str, List[str], or None) – The operation name to make a bar graph. Default ‘None’ makes a bar graph for all operations.
reading_time_basis (str) – ‘seconds’, ‘minutes’, or ‘hours’.
calculate_type (str) – ‘total’ or ‘average’. How a multiple values integrate.
operation_bar_colors (List[str] or None) – The colors of operation bar plots. Required same number of elements with the number of operations. If default ‘None’, the colors are automatically decided.
reading_time_color (str) – The color of reading-time bar plots. The default value is ‘brouwn’.
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
- Returns
The bar graph represents operation count and reading time in each page.
- Return type
matplotlib.figure.Figure
- OpenLA.data_visualization.visualize_pages_in_time_range(time_range_aggregation, contents_id, user_id=None, xlabel=None, ylabel=None, ax=None, figsize=None, fontsize=None, save_file=None, show_legend=False)[source]¶
Draw a line graph which represents which page is read in time ranges.
- Parameters
time_range_aggregation (TimeRangeAggregation) – TImeRangeAggregation instance
contents_id (str) – The contents id to make graph
user_id (str, List[str], or None) – The user id to make graph
xlabel (str) – The label name of x-axis
ylabel (str) – The label name of y-axis
ax (matplotlib.axes.Axes or None) – The axes to plot the figure on. If None, new axes is created
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
show_legend (bool) – Whether to show legend of the graph. If the number of users in this graph is large, this argument is recommended to be set False.
- Returns
The line graph which shows the page tracking
- Return type
matplotlib.axes.Axes
- OpenLA.data_visualization.visualize_operation_in_time_range(time_range_aggregation, contents_id, user_id=None, operation_name=None, calculate_type='total', operation_bar_colors=None, xlabel=None, ylabel=None, ax=None, figsize=None, fontsize=None, save_file=None)[source]¶
Draw a bar graph which represents how many operations are used in time ranges.
- Parameters
time_range_aggregation (TimeRangeAggregation) – TImeRangeAggregation instance
contents_id (str) – The contents id to make graph
user_id (str, List[str], or None) – The user id to make graph
operation_name (str, List[str], or None) – The operation name to make a bar graph. Default ‘None’ makes a bar graph for all operations.
calculate_type (str) – ‘total’ or ‘average’. How a multiple values integrate.
operation_bar_colors (List[str] or None) – The colors of operation bar plots. Required same number of elements with the number of operations. If default ‘None’, the colors are automatically decided.
xlabel (str) – The label name of x-axis
ylabel (str) – The label name of y-axis
ax (matplotlib.axes.Axes or None) – The axes to plot the figure on. If None, new axes is created
figsize (tuple(float, float) or None) – Figure size
save_file (str or None) – The file path for saving the graph
- Returns
The line graph which shows the page tracking
- Return type
matplotlib.axes.Axes