hypertools.DataGeometry

class hypertools.DataGeometry(fig=None, ax=None, line_ani=None, data=None, xform_data=None, reduce=None, align=None, normalize=None, semantic=None, vectorizer=None, corpus=None, kwargs=None, version='0.6.2', dtype=None)[source]

Hypertools data object class

A DataGeometry object contains the data, figure handles and transform functions used to create a plot. Note: this class should not be called directly, but is used by the hyp.plot function to create a plot object.

Parameters
figmatplotlib.Figure

The matplotlib figure handle for the plot

axmatplotlib.Axes

The matplotlib axes handle for the plot

line_animatplotlib.animation.FuncAnimation

The matplotlib animation handle (if the plot is an animation)

datalist

A list of numpy arrays representing the raw data

xform_datalist

A list of numpy arrays representing the transformed data

reducedict

A dictionary containing the reduction model and parameters

aligndict

A dictionary containing align model and parameters

normalizestr

A string representing the kind of normalization

kwargsdict

A dictionary containing all kwargs passed to the plot function

versionstr

The version of the software used to create the class instance

Methods

get_data(self)

Return a copy of the data

get_formatted_data(self)

Return a formatted copy of the data

plot(self[, data])

Plot the data

save(self, fname[, compression])

Save method for the data geometry object

transform(self[, data])

Return transformed data, or transform new data using the same model parameters

get_data(self)[source]

Return a copy of the data

get_formatted_data(self)[source]

Return a formatted copy of the data

plot(self, data=None, **kwargs)[source]

Plot the data

Parameters
datanumpy array, pandas dataframe or list of arrays/dfs

The data to plot. If no data is passed, the xform_data from the DataGeometry object will be returned.

kwargskeyword arguments

Any keyword arguments supported by hypertools.plot are also supported by this method

Returns
geohypertools.DataGeometry

A new data geometry object

save(self, fname, compression='blosc')[source]

Save method for the data geometry object

The data will be saved as a ‘geo’ file, which is a dictionary containing the elements of a data geometry object saved in the hd5 format using deepdish.

Parameters
fnamestr

A name for the file. If the file extension (.geo) is not specified, it will be appended.

compressionstr

The kind of compression to use. See the deepdish documentation for options: http://deepdish.readthedocs.io/en/latest/api_io.html#deepdish.io.save

transform(self, data=None)[source]

Return transformed data, or transform new data using the same model parameters

Parameters
datanumpy array, pandas dataframe or list of arrays/dfs

The data to transform. If no data is passed, the xform_data from the DataGeometry object will be returned.

Returns
xformed_datalist of numpy arrays

The transformed data