API Reference

class pdvega.Axes(spec=None, data=None)

Class representing a pdvega plot axes

display()
data
spec
spec_no_data
class pdvega.FramePlotMethods(data)

DataFrame Accessor & Method for creating Vega-Lite visualizations.

Examples

>>> df.vgplot.line()  
>>> df.vgplot.area()  
>>> df.vgplot.bar()  
>>> df.vgplot.barh()  
>>> df.vgplot.hist()  
>>> df.vgplot.kde()  
>>> df.vgplot.density()  
>>> df.vgplot.scatter(x, y)  
>>> df.vgplot.hexbin(x, y)  

Plotting methods can also be accessed by calling the accessor as a method with the kind argument: df.vgplot(kind='line', **kwds) is equivalent to df.vgplot.line(**kwds)

area(x=None, y=None, stacked=True, alpha=None, var_name='variable', value_name='value', interactive=True, width=450, height=300, **kwds)

Area plot for DataFrame data

>>> dataframe.vgplot.area()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

stacked : bool, optional

if True (default) then create a stacked area chart. Otherwise, areas will overlap

alpha : float, optional

transparency level, 0 <= alpha <= 1

var_name : string, optional

the legend title

value_name : string, optional

the y-axis label

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

bar(x=None, y=None, stacked=False, alpha=None, var_name='variable', value_name='value', interactive=True, width=450, height=300, **kwds)

Bar plot for DataFrame data

>>> dataframe.vgplot.bar()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

stacked : bool, optional

if True (default) then create a stacked area chart. Otherwise, areas will overlap

alpha : float, optional

transparency level, 0 <= alpha <= 1

var_name : string, optional

the legend title

value_name : string, optional

the y-axis label

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

barh(x=None, y=None, stacked=False, alpha=None, var_name='variable', value_name='value', interactive=True, width=450, height=300, **kwds)

Horizontal bar plot for DataFrame data

>>> dataframe.vgplot.barh()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

stacked : bool, optional

if True (default) then create a stacked area chart. Otherwise, areas will overlap

alpha : float, optional

transparency level, 0 <= alpha <= 1

var_name : string, optional

the legend title

value_name : string, optional

the y-axis label

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

density(x=None, y=None, bw_method=None, alpha=None, interactive=True, width=450, height=300, **kwds)

Kernel Density Estimate plot for DataFrame data

>>> dataframe.vgplot.kde()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

bw_method : str, scalar or callable, optional

The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. See scipy.stats.gaussian_kde for more details.

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

heatmap(x, y, C=None, reduce_C_function=None, gridsize=100, alpha=None, interactive=True, width=450, height=300, **kwds)

Heatmap plot for DataFrame data

Note that Vega-Lite does not support hexagonal binning, so this method returns a cartesian heatmap.

>>> dataframe.vgplot.hexbin()  
Parameters:

x : string

the column to use as the x-axis variable.

y : string

the column to use as the y-axis variable.

C : string, optional

the column to use to compute the mean within each bin. If not specified, the count within each bin will be used.

reduce_C_function : callable, optional

the type of reduction to be done within each bin (not implemented)

gridsize : int, optional

the number of divisions in the x and y axis (default=100)

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

hexbin(x, y, C=None, reduce_C_function=None, gridsize=100, alpha=None, interactive=True, width=450, height=300, **kwds)

Heatmap plot for DataFrame data

Note that Vega-Lite does not support hexagonal binning, so this method returns a cartesian heatmap.

>>> dataframe.vgplot.hexbin()  
Parameters:

x : string

the column to use as the x-axis variable.

y : string

the column to use as the y-axis variable.

C : string, optional

the column to use to compute the mean within each bin. If not specified, the count within each bin will be used.

reduce_C_function : callable, optional

the type of reduction to be done within each bin (not implemented)

gridsize : int, optional

the number of divisions in the x and y axis (default=100)

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

hist(x=None, y=None, by=None, bins=10, stacked=False, alpha=None, histtype='bar', var_name='variable', value_name='value', interactive=True, width=450, height=300, **kwds)

Histogram plot for DataFrame data

>>> dataframe.vgplot.hist()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

by : string, optional

the column by which to group the results

bins : integer, optional

the maximum number of bins to use for the histogram (default: 10)

stacked : bool, optional

if True (default) then create a stacked area chart. Otherwise, areas will overlap

alpha : float, optional

transparency level, 0 <= alpha <= 1

histtype : string, {‘bar’, ‘step’, ‘stepfilled’}

The type of histogram to generate. Default is ‘bar’.

var_name : string, optional

the legend title

value_name : string, optional

the y-axis label

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

kde(x=None, y=None, bw_method=None, alpha=None, interactive=True, width=450, height=300, **kwds)

Kernel Density Estimate plot for DataFrame data

>>> dataframe.vgplot.kde()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

bw_method : str, scalar or callable, optional

The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. See scipy.stats.gaussian_kde for more details.

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

line(x=None, y=None, alpha=None, var_name='variable', value_name='value', interactive=True, width=450, height=300, **kwds)

Line plot for DataFrame data

>>> dataframe.vgplot.line()  
Parameters:

x : string, optional

the column to use as the x-axis variable. If not specified, the index will be used.

y : string, optional

the column to use as the y-axis variable. If not specified, all columns (except x if specified) will be used.

alpha : float, optional

transparency level, 0 <= alpha <= 1

var_name : string, optional

the legend title

value_name : string, optional

the y-axis label

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

scatter(x, y, c=None, s=None, alpha=None, interactive=True, width=450, height=300, **kwds)

Scatter plot for DataFrame data

>>> dataframe.vgplot.scatter(x, y)  
Parameters:

x : string

the column to use as the x-axis variable.

y : string

the column to use as the y-axis variable.

c : string, optional

the column to use to encode the color of the points

s : string, optional

the column to use to encode the size of the points

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

class pdvega.SeriesPlotMethods(data)

Series Accessor & Method for creating Vega-Lite visualizations.

Examples

>>> s.vgplot.line()  
>>> s.vgplot.area()  
>>> s.vgplot.bar()  
>>> s.vgplot.barh()  
>>> s.vgplot.hist()  
>>> s.vgplot.kde()  
>>> s.vgplot.density()  

Plotting methods can also be accessed by calling the accessor as a method with the kind argument: s.vgplot(kind='line', **kwds) is equivalent to s.vgplot.line(**kwds)

area(alpha=None, interactive=True, width=450, height=300, **kwds)

Area plot for Series data

>>> series.vgplot.area()  
Parameters:

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

bar(alpha=None, interactive=True, width=450, height=300, **kwds)

Bar plot for Series data

>>> series.vgplot.bar()  
Parameters:

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

barh(alpha=None, interactive=True, width=450, height=300, **kwds)

Horizontal bar plot for Series data

>>> series.vgplot.barh()  
Parameters:

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

density(bw_method=None, alpha=None, interactive=True, width=450, height=300, **kwds)

Kernel Density Estimation plot for Series data

>>> series.vgplot.kde()  
Parameters:

bw_method : str, scalar or callable, optional

The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. See scipy.stats.gaussian_kde for more details.

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

hist(bins=10, alpha=None, histtype='bar', interactive=True, width=450, height=300, **kwds)

Histogram plot for Series data

>>> series.vgplot.hist()  
Parameters:

bins : integer, optional

the maximum number of bins to use for the histogram (default: 10)

alpha : float, optional

transparency level, 0 <= alpha <= 1

histtype : string, {‘bar’, ‘step’, ‘stepfilled’}

The type of histogram to generate. Default is ‘bar’.

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

kde(bw_method=None, alpha=None, interactive=True, width=450, height=300, **kwds)

Kernel Density Estimation plot for Series data

>>> series.vgplot.kde()  
Parameters:

bw_method : str, scalar or callable, optional

The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. See scipy.stats.gaussian_kde for more details.

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

line(alpha=None, interactive=True, width=450, height=300, **kwds)

Line plot for Series data

>>> series.vgplot.line()  
Parameters:

alpha : float, optional

transparency level, 0 <= alpha <= 1

interactive : bool, optional

if True (default) then produce an interactive plot

width : int, optional

the width of the plot in pixels

height : int, optional

the height of the plot in pixels

Returns:

axes : pdvega.Axes

The vega-lite plot

pdvega.andrews_curves(data, class_column, samples=200, alpha=None, width=450, height=300, interactive=True, **kwds)
pdvega.lag_plot(data, lag=1, **kwds)

Lag plot for time series.

Parameters:

data: pandas.Series

the time series to plot

lag: integer

The lag of the scatter plot, default=1

kwds:

Additional keywords passed to data.vgplot.scatter

Returns:

plot: VegaLite plot object

pdvega.parallel_coordinates(data, class_column, cols=None, alpha=None, width=450, height=300, interactive=True, var_name='variable', value_name='value', **kwds)

Parallel coordinates plotting.

Parameters:

frame: DataFrame

class_column: str

Column name containing class names

cols: list, optional

A list of column names to use

alpha: float, optional

The transparency of the lines

Returns:

plot : VegaLite object

The Vega-Lite representation of the plot.

See also

pandas.plotting.parallel_coordinates
matplotlib version of this routine
pdvega.scatter_matrix(frame, c=None, s=None, figsize=None, dpi=72.0, **kwds)

Draw a matrix of scatter plots.

The result is an interactive pan/zoomable plot, with linked-brushing enabled by holding the shift key.

Parameters:

frame : DataFrame

The dataframe for which to draw the scatter matrix.

c : string (optional)

If specified, the name of the column to be used to determine the color of each point.

s : string (optional)

If specified, the name of the column to be used to determine the size of each point,

figsize : tuple (optional)

A length-2 tuple speficying the size of the figure in inches

dpi : float (default=72)

The dots (i.e. pixels) per inch used to convert the figure size from inches to pixels.

Returns:

plot : VegaLite object

The Vega-Lite representation of the plot.

See also

pandas.plotting.scatter_matrix
matplotlib version of this routine