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.
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.
-
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
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
-
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.
-
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
See also
lux.vis.Vis.refresh_source()
Note
Function derives a new _inferred_intent by instantiating the intent specification on the new data
-
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
-
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
¶
-