XPlot

class xframes.XPlot(axes=None, alpha=None)[source]

Plotting library for XFrames.

Creates simple data plots.

Parameters:

axes : list, optional

The size of the axes. Should be a four-element list. [x_origin, y_origin, x_length, y_length] Defaults to [0.0, 0.0, 1.5, 1.0]

alpha : float, optional

The opacity of the plot.

__init__(axes=None, alpha=None)[source]

Create a plotting object.

Parameters:

axes : list, optional

The size of the axes. Should be a four-element list. [x_origin, y_origin, x_length, y_length] Defaults to [0.0, 0.0, 1.5, 1.0]

alpha : float, optional

The opacity of the plot.

col_info(column, column_name=None, table_name=None, title=None, topk=None, bins=None, cutoff=False)[source]

Print column summary information.

The number of the most frequent values is shown. If the column to summarize is numerical or datetime, then a histogram is also shown.

Parameters:

column : XArray

The column to summarize.

column_name : str

The column name.

table_name : str, optional

The table name; used to labeling only. The table that us used for the data is given in the constructor.

title : str, optional

The plot title.

topk: int, optional

The number of frequent items to show.

bins : int, optional

The number of bins in a histogram.

cutoff : float, optional

The number to use as an upper cutoff, if the plot is a histogram.

Examples

(Need examples)

frequent_values(column, k=15, title=None, append_counts_to_label=False, normalize=False, xlabel=None, ylabel=None, epsilon=None, delta=None, num_items=None)[source]

Plots the number of occurances of specific values in a column.

The most frequent values are plotted.

Parameters:

column : XArray

The column to plot. The number of distinct occurrances of each value is calculated and plotted.

k : int, optional

The number of different values to plot. Defaults to 15.

title : str, optional

A plot title.

append_counts_to_label : boolean, optional

If true, append the bar count to the label

normalize : bool, optional

If true, plot percentages instead of counts. Defaults to False.

xlabel : str, optional

A label for the X axis.

ylabel : str, optional

A label for the Y axis.

epsilon : float, optional

Governs accuracy of frequency counter.

delta : float, optional

Governs accuracy of frequency counter.

num_items : float, optional

Governs accuracy of frequency counter.

Returns:

list of tuples

List of (value, count) for the most frequent “k” values

Examples

(Need examples)

histogram(column, title=None, bins=None, sketch=None, xlabel=None, ylabel=None, lower_cutoff=0.0, upper_cutoff=1.0, lower_bound=None, upper_bound=None)[source]

Plot a histogram.

All values greater than the cutoff (given as a quantile) are set equal to the cutoff.

Parameters:

column : XArray

A column to display.

title : str, optional

A plot title.

bins : int, optional

The number of bins to use. Defaults to 50.

sketch : Sketch, optional

The column sketch. If this is available, then it saves time not to recompute it.

xlabel : str, optional

A label for the X axis.

ylabel : str, optional

A label for the Y axis.

lower_cutoff : float, optional

This is a quantile value, between 0 and 1. Values below this cutoff are placed in the first bin. Defaults to 0.

upper_cutoff : float, optional

This is a quantile value, between 0 and 1. Values above this cutoff are placed in the last bin. Defaults to 1.0.

lower_bound : float, optional

Values below this bound are placed in the first bin.

upper_bound : float, optional

Values below this bound are placed in the last bin.

bins : int, optional

The number of bins to use. Defaults to 50.

Examples

(Need examples)

top_values(xf, x_col, y_col, k=15, title=None, xlabel=None, ylabel=None)[source]

Plot the top values of a column of data.

Parameters:

xf : XFrame

An XFrame containing the columns to be plotted.

x_col : str

A column name: the top values in this column are plotted. These values must be numerical.

y_col : str

A column name: the values in this colum will be used to label the corresponding values in the x column.

k : int, optional

The number of values to plot. Defaults to 15.

title : str, optional

A plot title.

xlabel : str, optional

A label for the X axis.

ylabel : str, optional

A label for the Y axis.

Examples

(Come up with an example)