lux.processor.Compiler.Compiler¶
-
class
lux.processor.Compiler.
Compiler
[source]¶ Given a intent with underspecified inputs, compile the intent into fully specified visualizations for visualization.
Methods
__init__
()Initialize self. compile_intent
(ldf, _inferred_intent)Compiles input specifications in the intent of the ldf into a collection of lux.vis objects for visualization. compile_vis
(ldf, vis)Root method for compiling visualizations determine_encoding
(ldf, vis)Populates Vis with the appropriate mark type and channel information based on ShowMe logic Currently support up to 3 dimensions or measures enforce_specified_channel
(vis, auto_channel, …)Enforces that the channels specified in the Vis by users overrides the showMe autoChannels. enumerate_collection
(_inferred_intent, ldf)Given specifications that have been expanded thorught populateOptions, recursively iterate over the resulting list combinations to generate a vis list. populate_data_type_model
(ldf, vlist)Given a underspecified Clause, populate the data_type and data_model information accordingly populate_wildcard_options
(_inferred_intent, ldf)Given wildcards and constraints in the LuxDataFrame’s intent, return the list of available values that satisfies the data_type or data_model constraints. remove_all_invalid
(vis_collection)Given an expanded vis list, remove all visualizations that are invalid. -
static
compile_intent
(ldf: lux.core.frame.LuxDataFrame, _inferred_intent: List[lux.vis.Clause.Clause]) → lux.vis.VisList.VisList[source]¶ Compiles input specifications in the intent of the ldf into a collection of lux.vis objects for visualization. 1) Enumerate a collection of visualizations interested by the user to generate a vis list 2) Expand underspecified specifications(lux.Clause) for each of the generated visualizations. 3) Determine encoding properties for each vis
Parameters: - ldf (lux.core.frame) – LuxDataFrame with underspecified intent.
- vis_collection (list[lux.vis.Vis]) – empty list that will be populated with specified lux.Vis objects.
Returns: vis_collection – vis list with compiled lux.Vis objects.
Return type: list[lux.Vis]
-
static
compile_vis
(ldf: lux.core.frame.LuxDataFrame, vis: lux.vis.Vis.Vis) → lux.vis.Vis.Vis[source]¶ Root method for compiling visualizations
Parameters: - ldf (LuxDataFrame) –
- vis (Vis) –
Returns: Compiled Vis object
Return type:
-
static
determine_encoding
(ldf: lux.core.frame.LuxDataFrame, vis: lux.vis.Vis.Vis)[source]¶ Populates Vis with the appropriate mark type and channel information based on ShowMe logic Currently support up to 3 dimensions or measures
Parameters: - ldf (lux.core.frame) – LuxDataFrame with underspecified intent
- vis (lux.vis.Vis) –
Returns: Return type: None
Notes
Implementing automatic encoding from Tableau’s VizQL Mackinlay, J. D., Hanrahan, P., & Stolte, C. (2007). Show Me: Automatic presentation for visual analysis. IEEE Transactions on Visualization and Computer Graphics, 13(6), 1137–1144. https://doi.org/10.1109/TVCG.2007.70594
-
static
enforce_specified_channel
(vis: lux.vis.Vis.Vis, auto_channel: Dict[str, str])[source]¶ Enforces that the channels specified in the Vis by users overrides the showMe autoChannels.
Parameters: - vis (lux.vis.Vis) – Input Vis without channel specification.
- auto_channel (Dict[str,str]) – Key-value pair in the form [channel: attributeName] specifying the showMe recommended channel location.
Returns: vis – Vis with channel specification combining both original and auto_channel specification.
Return type: lux.vis.Vis
Raises: ValueError
– Ensures no more than one attribute is placed in the same channel.
-
static
enumerate_collection
(_inferred_intent: List[lux.vis.Clause.Clause], ldf: lux.core.frame.LuxDataFrame) → lux.vis.VisList.VisList[source]¶ Given specifications that have been expanded thorught populateOptions, recursively iterate over the resulting list combinations to generate a vis list.
Parameters: ldf (lux.core.frame) – LuxDataFrame with underspecified intent. Returns: VisList – vis list with compiled lux.Vis objects. Return type: list[lux.Vis]
-
static
populate_data_type_model
(ldf, vlist)[source]¶ Given a underspecified Clause, populate the data_type and data_model information accordingly
Parameters: - ldf (lux.core.frame) – LuxDataFrame with underspecified intent
- vis_collection (list[lux.vis.Vis]) – List of lux.Vis objects that will have their underspecified Clause details filled out.
-
static
populate_wildcard_options
(_inferred_intent: List[lux.vis.Clause.Clause], ldf: lux.core.frame.LuxDataFrame) → dict[source]¶ Given wildcards and constraints in the LuxDataFrame’s intent, return the list of available values that satisfies the data_type or data_model constraints.
Parameters: ldf (LuxDataFrame) – LuxDataFrame with row or attributes populated with available wildcard options. Returns: intent – a dictionary that holds the attributes and filters generated from wildcards and constraints. Return type: Dict[str,list]
-
static
remove_all_invalid
(vis_collection: lux.vis.VisList.VisList) → lux.vis.VisList.VisList[source]¶ Given an expanded vis list, remove all visualizations that are invalid. Currently, the invalid visualizations are ones that contain two of the same attribute, no more than two temporal attributes, or overlapping attributes (same filter attribute and visualized attribute). :param vis_collection: empty list that will be populated with specified lux.Vis objects. :type vis_collection: list[lux.vis.Vis]
Returns: vis list with compiled lux.Vis objects. Return type: lux.vis.VisList
-
static