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 = '', exclude: Union[str, list] = '')[source]

Bases: object

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

copy_clause()[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.

clear_plot_config()[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]
render_VSpec(renderer='altair')[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_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]

property code
property data
property intent
property mark
property min_max
property plot_config

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.

bottomK(k)[source]
clear_plot_config()[source]
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.

Parameters

ldf (LuxDataframe) – Input Dataframe to be attached to the VisList

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 Vis List

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

Parameters

intent (List[Clause]) – Query specifying the desired VisList

set_plot_config(config_func: Callable)[source]

Modify plot aesthetic settings to the Vis List Currently only supported for Altair visualizations

Parameters

config_func (typing.Callable) – A function that takes in an AltairChart (https://altair-viz.github.io/user_guide/generated/toplevel/altair.Chart.html) as input and returns an AltairChart as output

sort(remove_invalid=True, descending=True)[source]
topK(k)[source]
property exported

Get selected visualizations as exported Vis List

Notes

Convert the _exportedVisIdxs dictionary into a programmable VisList Example _exportedVisIdxs :

{‘Vis List’: [0, 2]}

VisList

return a VisList of selected visualizations. -> VisList(v1, v2…)

property intent

Module contents