Visualization

visualize_trace(df, stroke_indices, stroke_id)

Generates a plot visualizing the trace of a stroke.

Parameters:
  • df (pd.DataFrame) – DataFrame containing the stroke data with ‘x’, ‘y and ‘timeStamp’ columns.

  • stroke_indices (list) – List of indices corresponding to the stroke in the DataFrame. Can be obtained using df.index.

  • stroke_id (str) – Identifier for the stroke to be displayed in the title.

Returns:

Displays a plot of the stroke trace.

Return type:

None

video_from_trace(df, user_id, outfile, width=640, height=480, fps=30, colored=False)

Generates a video visualizing the mouse trace of a user.

Parameters:
  • df (pd.DataFrame) – DataFrame containing the mouse trace data with ‘x’, ‘y’, ‘eventType’, and ‘sessionId’ columns.

  • user_id (str/int) – Identifier of the user whose trace is to be visualized.

  • outfile (str) – Path to save the output video file.

  • width (int) – Width of the video frame.

  • height (int) – Height of the video frame.

  • fps (int) – Frames per second for the video.

  • colored (bool) – If True, applies a temperature gradient (green to red) to the trajectory line.

Returns:

Saves the video file to the specified path.

Return type:

None