lux.vis package

Submodules

lux.vis.Clause module

class lux.vis.Clause.Clause(description: Union[str, list] = '', attribute: Union[str, list] = '', value: Union[str, list] = '', filter_op: str = '=', channel: str = '', data_type: str = '', data_model: str = '', aggregation: Union[str, callable] = '', bin_size: int = 0, weight: float = 1, sort: str = '', timescale: str = '', exclude: Union[str, list] = '')[source]

Bases: object

Clause is the object representation of a single unit of the specification.

copy_clause()[source]
get_attr()[source]
set_aggregation(aggregation: Union[str, callable])[source]

Sets the aggregation function of Clause, while updating _aggregation_name internally

Parameters:aggregation (typing.Union[str,callable]) –
to_string()[source]

lux.vis.Vis module

class lux.vis.Vis.Vis(intent, source=None, title='', score=0.0)[source]

Bases: object

Vis Object represents a collection of fully fleshed out specifications required for data fetching and visualization.

check_not_vislist_intent()[source]
get_attr_by_attr_name(attr_name)[source]
get_attr_by_channel(channel)[source]
get_attr_by_data_model(dmodel, exclude_record=False)[source]
get_attr_by_data_type(dtype)[source]
refresh_source(ldf)[source]

Loading the source data into the Vis by instantiating the specification and populating the Vis based on the source data, effectively “materializing” the Vis.

Parameters:ldf (LuxDataframe) – Input Dataframe to be attached to the Vis
Returns:Complete Vis with fully-specified fields
Return type:Vis

See also

lux.Vis.VisList.refresh_source()

Note

Function derives a new _inferred_intent by instantiating the intent specification on the new data

remove_column_from_spec(attribute, remove_first: bool = False)[source]

Removes an attribute from the Vis’s clause

Parameters:
  • attribute (str) – attribute to be removed
  • remove_first (bool, optional) – Boolean flag to determine whether to remove all instances of the attribute or only one (first) instance, by default False
remove_filter_from_spec(value)[source]
set_intent(intent: List[lux.vis.Clause.Clause]) → None[source]

Sets the intent of the Vis and refresh the source based on the new intent

Parameters:intent (List[Clause]) – Query specifying the desired VisList
to_altair(standalone=False) → str[source]

Generate minimal Altair code to visualize the Vis

Parameters:standalone (bool, optional) – Flag to determine if outputted code uses user-defined variable names or can be run independently, by default False
Returns:String version of the Altair code. Need to print out the string to apply formatting.
Return type:str
to_code(language='vegalite', **kwargs)[source]

Export Vis object to code specification

Parameters:language (str, optional) – choice of target language to produce the visualization code in, by default “vegalite”
Returns:visualization specification corresponding to the Vis object
Return type:spec
to_matplotlib() → str[source]

Generate minimal Matplotlib code to visualize the Vis

Returns:String version of the Matplotlib code. Need to print out the string to apply formatting.
Return type:str
to_vegalite(prettyOutput=True) → Union[dict, str][source]

Generate minimal Vega-Lite code to visualize the Vis

Returns:String or Dictionary of the VegaLite JSON specification
Return type:Union[dict,str]
code
data
intent
mark
min_max

lux.vis.VisList module

class lux.vis.VisList.VisList(input_lst: Union[List[lux.vis.Vis.Vis], List[lux.vis.Clause.Clause]], source=None)[source]

Bases: object

VisList is a list of Vis objects.

get(field_name)[source]
map(function)[source]
normalize_score(invert_order=False)[source]
refresh_source(ldf)[source]

Loading the source into the visualizations in the VisList, then populating each visualization based on the new source data, effectively “materializing” the visualization collection. :param ldf: Input Dataframe to be attached to the VisList :type ldf: LuxDataframe

Returns:Complete VisList with fully-specified fields
Return type:VisList

See also

lux.vis.Vis.refresh_source()

Note

Function derives a new _inferred_intent by instantiating the intent specification on the new data

remove_duplicates() → None[source]

Removes duplicate visualizations in VisList

remove_index(index)[source]
set(field_name, field_val)[source]
set_intent(intent: List[lux.vis.Clause.Clause]) → None[source]

Sets the intent of the VisList and refresh the source based on the new clause :param intent: Query specifying the desired VisList :type intent: List[Clause]

showK()[source]
sort(remove_invalid=True, descending=True)[source]
exported

Get selected visualizations as exported Vis List

Notes

Convert the _selectedVisIdxs dictionary into a programmable VisList Example _selectedVisIdxs :

{‘Vis List’: [0, 2]}
Returns:return a VisList of selected visualizations. -> VisList(v1, v2…)
Return type:VisList
intent

Module contents