lux.vis.Vis.Vis¶
-
class
lux.vis.Vis.Vis(intent, source=None, title='', score=0.0)[source]¶ Vis Object represents a collection of fully fleshed out specifications required for data fetching and visualization.
-
__init__(intent, source=None, title='', score=0.0)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(intent[, source, title, score])Initialize self. check_not_vislist_intent()get_attr_by_attr_name(attr_name)get_attr_by_channel(channel)get_attr_by_data_model(dmodel[, exclude_record])get_attr_by_data_type(dtype)refresh_source(ldf)Loading the source data into the Vis by instantiating the specification and populating the Vis based on the source data, effectively “materializing” the Vis. remove_column_from_spec(attribute, remove_first)Removes an attribute from the Vis’s clause remove_filter_from_spec(value)set_intent(intent)Sets the intent of the Vis and refresh the source based on the new intent to_altair([standalone])Generate minimal Altair code to visualize the Vis to_code([language])Export Vis object to code specification to_matplotlib()Generate minimal Matplotlib code to visualize the Vis to_vegalite([prettyOutput])Generate minimal Vega-Lite code to visualize the Vis Attributes
codedataintentmarkmin_max-
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
-
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
-