imhr.Webgazer.plot

@purpose: Hub for creating plots.
@date: Created on Sat May 1 15:12:38 2019
@author: Semeon Risom

Functions

bokeh_calibration(config, df, cxy, event[, …]) Create calibration matrix, using pandas and bokeh.
bokeh_trial(config, df, stim_bounds, …) Create single subject trial bokeh plots.
boxplot(config, df[, path, x, y, title, …]) Creates boxplot using seaborn and pandas.
cooks_plot(config, y, model, path, df) Create cooks distance plot plot using seaborn, pandas, and statsmodel.
corr_matrix(config, df, path, title, method) Create correlation matrix using bokeh and pandas
density_plot(config, df, title) Create density plot (draws kernel density estimate), using seaborn and pandas
html(config[, df, raw_data, name, path, …]) Create html output.
logit_plot(config, df, path, param) Create logistic regression plot using seaborn and pandas
onset_diff_plot(config, df, meta, drop, y[, …]) Plot onset differences using pandas and seaborn.
qq_plot(config, y, residuals, path) Create probability plot using seaborn, pandas, and rpy2.
residual_plot(config, y, residuals, path) Create probability plot using seaborn, pandas, and rpy2.
imhr.Webgazer.plot.bokeh_trial(config, df, stim_bounds, roi_bounds, flt)[source]

Create single subject trial bokeh plots.

Parameters:
df : pandas.core.frame.DataFrame

Pandas dataframe of participant sample data.

stim_bounds : dict

Stimulus bounds on screen.

roi_bounds : dict

ROI bounds on screen.

flt : str

Filter type.

imhr.Webgazer.plot.bokeh_calibration(config, df, cxy, event, monitorSize=[1920, 1080])[source]

Create calibration matrix, using pandas and bokeh.

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

cxy : pandas.core.frame.DataFrame

Pandas dataframe of calibration points.

event : string

calibration, or validation.

monitorSize : list

Monitor size, in pixels.

imhr.Webgazer.plot.onset_diff_plot(config, df, meta, drop, y, clip=None)[source]

Plot onset differences using pandas and seaborn.

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

meta : pandas.core.frame.DataFrame

Metadata for each chart.

drop : pandas.core.frame.DataFrame

Participants to be dropped.

y : str

Variable of interest.

clip : int

Clip value for single subject plot.

Returns:
odp

Bokeh or seaborn plot.

imhr.Webgazer.plot.density_plot(config, df, title)[source]

Create density plot (draws kernel density estimate), using seaborn and pandas

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

title : str

Chart title.

Returns:
cm

Bokeh or seaborn plot.

imhr.Webgazer.plot.corr_matrix(config, df, path, title, method, footnote=None)[source]

Create correlation matrix using bokeh and pandas

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

path : str

The directory path to save the bokeh or plot.

method : str

Spearman or Pearsons correlation coefficient.

title : str

Chart title.

footnote : str

Chart footnote.

Returns:
cm

Bokeh plot.

imhr.Webgazer.plot.boxplot(config, df, path=None, x=None, y=None, title=None, plots=None, cat='analysis')[source]

Creates boxplot using seaborn and pandas.

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

path : str

Path to save data.

drift : str

X-axis.

drift : str

Y-axis.

title : str

Plot title.

plots : dict

Dictionary of plots metadata.

cat : str

Type of plot.

imhr.Webgazer.plot.cooks_plot(config, y, model, path, df)[source]

Create cooks distance plot plot using seaborn, pandas, and statsmodel.

Parameters:
config : dict

Configuration data.

df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

path : str

The directory path save the seaborn plot.

y : str

The predictor variable.

model : dict

statsmodel model.

Returns:
res

seaborn plot.

imhr.Webgazer.plot.residual_plot(config, y, residuals, path)[source]

Create probability plot using seaborn, pandas, and rpy2.

Parameters:
config : dict

Configuration data.

y : str

Predictor variable.

residuals : pandas.core.frame.DataFrame

Pandas dataframe of residuals vs fitted, qq data, and raw data.

path : str

The directory path save the seaborn plot.

Returns:
lmp

seaborn plot.

imhr.Webgazer.plot.qq_plot(config, y, residuals, path)[source]

Create probability plot using seaborn, pandas, and rpy2.

Parameters:
config : dict

Configuration data.

y : str

Predictor variable.

residuals : pandas.core.frame.DataFrame

Pandas dataframe of residuals vs fitted, qq data, and raw data.

path : str

The directory path save the seaborn plot.

Returns:
lmp

seaborn plot.

imhr.Webgazer.plot.logit_plot(config, df, path, param)[source]

Create logistic regression plot using seaborn and pandas

Parameters:
df : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

path : str

The directory path save the seaborn plot.

param : dict

x, y, groupby parameters.

Returns:
lmp

seaborn plot.

imhr.Webgazer.plot.html(config, df=None, raw_data=None, name=None, path=None, plots=None, source=None, title=None, intro=None, footnote=None, script='', **kwargs)[source]

Create html output.

Parameters:
df : pandas.core.frame.DataFrame

Pandas dataframe of analysis results data.

raw_data : pandas.core.frame.DataFrame

Pandas dataframe of raw data.

name : str

The name of csv file created (source=logit only).

path : str

The directory path of the html file.

plots : dict

If generating seaborn images, the list of plots used.

source : str

The type of data being recieved.

trial : str

(If Bokeh) Trial Number.

session : str

(If Bokeh) Session Number.

bokeh_type : str

(If Bokeh) Control directory location. If trial, create trial plots.

title : str

The title of the table or figure.

intro : str

The introduction of the group of figures or tables.

footnote : str

The footnote of the table or figure.

metadata : dict

Additional data to be included.

**kwargs : str or None, optional

Additional properties, relevent for specific content types. Here’s a list of available properties:

Property Description
short, long : str Short (aoi) and long form (Area of Interest) label of html page. This is primarily used for constructing metadata tags in html.
display : str (For bokeh) The type of calibration/validation display.
trial : str (For bokeh) The trial number for the eyetracking task.
session : int (For bokeh) The session number for the eyetracking task.
day : str (For bokeh) The day the eyetracking task was run.
Returns:
html : str

String of html code.