imhr.data.plot

@purpose: Hub for creating data visualizations using pandas, seaborn, and bokeh.
@date: Created on Sat May 1 15:12:38 2019
@author: Semeon Risom

Classes

Plot([isLibrary]) Hub for creating data visualizations using pandas, seaborn, and bokeh.
class imhr.data.plot.Plot(isLibrary=False)[source]

Bases: object

Hub for creating data visualizations using pandas, seaborn, and bokeh.

Methods

Methods

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([destination, df, raw_data, name, …]) 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.
single_subject(config, df, path) Create single subject scatterplot using seaborn and pandas.
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([destination, df, raw_data, name, …]) 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.
single_subject(config, df, path) Create single subject scatterplot using seaborn and pandas.
classmethod bokeh_trial(config, df, stim_bounds, roi_bounds, flt)[source]

Create single subject trial bokeh plots.

Parameters:
df : pandas.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.

classmethod bokeh_calibration(config, df, cxy, event, monitorSize=[1920, 1080])[source]

Create calibration matrix, using pandas and bokeh.

Parameters:
config : dict

Configuration data.

df : pandas.DataFrame

Pandas dataframe of raw data.

cxy : pandas.DataFrame

Pandas dataframe of calibration points.

event : string

calibration, or validation.

monitorSize : list

Monitor size, in pixels.

classmethod 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.DataFrame

Pandas dataframe of raw data.

meta : pandas.DataFrame

Metadata for each chart.

drop : pandas.DataFrame

Participants to be dropped.

y : str

Variable of interest.

clip : int

Clip value for single subject plot.

Returns:
odp

Bokeh or seaborn plot.

classmethod density_plot(config, df, title)[source]

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

Parameters:
config : dict

Configuration data.

df : pandas.DataFrame

Pandas dataframe of raw data.

title : str

Chart title.

Returns:
cm

Bokeh or seaborn plot.

classmethod corr_matrix(config, df, path, title, method, footnote=None)[source]

Create correlation matrix using bokeh and pandas.

Parameters:
config : dict

Configuration data.

df : pandas.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.

classmethod single_subject(config, df, path)[source]

Create single subject scatterplot using seaborn and pandas.

Parameters:
df : pandas.DataFrame

Pandas dataframe of raw data.

path : str

The directory path to save the bokeh or seaborn plot.

Returns:
cm

Bokeh or seaborn plot.

classmethod 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.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.

classmethod 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.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.

classmethod 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.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.

classmethod 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.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.

classmethod logit_plot(config, df, path, param)[source]

Create logistic regression plot using seaborn and pandas

Parameters:
df : pandas.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.

classmethod html(destination=None, 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:
destination : str

Path to save file to.

df : pandas.DataFrame

Pandas dataframe of analysis results data.

raw_data : pandas.DataFrame

Pandas dataframe of raw data.

name : str

(py::if source is logit) The name of csv file created.

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, int, or None, optional

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

class:kwargs
widths:25 50
header-rows:1
    • 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.