Frequently Asked Questions (FAQ)¶
How do I load in data for Lux?¶
You can use any of the data loading or dataframe creation commands from Pandas to load in data to be used with Lux.
Note that you must perform
import lux before you load in or create the dataframe.
What if my data is stored in a relational database?¶
What do I do with geographical attributes in my dataset?¶
Lux supports a variety of geographical data types in Pandas. For more information on how to handle temporal data in Lux, refer to the geographic entity tutorial.
How do I access all of the current recommendations shown in my widget?¶
The recommendations for Lux can be accessed via the
recommendationproperty of the dataframe (e.g.,
How do I set the Lux widgets to show up on default?¶
By default, we show the Pandas display and users can use the toggle button to switch to the Lux display. The
default_displayproperty allows users to change the setting so that the Lux widget is set as the default view for future operations:lux.config.default_display = "lux"
To switch back to Pandas as the default display:lux.config.default_display = "pandas"
How do I change the plotting library used for visualization?¶
I want to change the opacity of my chart, add title, change chart font size, etc. How do I modify chart settings?¶
To add custom plot settings to the recommendations, you can set the
lux.config.plotting_styleproperty. See this tutorial on how to configure chart properties. Lux supports chart modifications in Altair and Matplotlib.
How do I change aggregation functions, binning, or axis channels to non-default values?¶
To change the aggregation function to be something that is not average or set an attribute to display on the x-axis instead of y-axis, you can override the default values in the
lux.Clausespecification. To override automatically inferred properties, you can specify additional arguements inside
lux.vis.Clauseto set the value of the Clause properties. See this page for more details.
I want to look at the default recommendations that were recommended to me, how can I get the dataframe to display those?¶
To avoid information overload, Lux only displays the most relevant visualization to the user’s intent at that point. To get to the default recommendation (e.g., Correlation, Distribution, Occurrence, Temporal), you should first clear the intent attached to the dataframedf.clear_intent()
Then you should see the visualizations after printing it out again.df
How do I turn off Lux?¶
To display only the Pandas view of the dataframe, print the dataframe by doing
df.to_pandas(). To turn off Lux completely, remove the
import luxstatement and restart your Jupyter notebook.
How do I disable sampling and have Lux visualize the full dataset?¶
When visualizing large datasets, Lux may display a warning stating “Large dataframe detected: Lux is only visualizing a random sample”. If you would like to disable sampling, you can run:lux.config.sampling = False
Note that if you have already loaded your data in and printed the visualizations, you would need to reinitialize the Dataframe by setting the config before loading in your data, as such:lux.config.sampling = False df = pd.read_csv("...")
If you want to fine-tune the sampling parameters, you can edit
lux.config.sampling_cap. See this page for more details.
The Lux Jupyter widget does not show up when I print a dataframe.¶
- If you recieve the output message
LuxWidget(...)but you do not see Lux widget show up, it is possible that the widget is not installed correctly. Run
jupyter nbextension liston the terminal, and you should see the following as one of the listed items.luxWidget/extension enabled - Validating: OK
- If you are able to import lux successfully and you do not see the “Toggle button” when you print the dataframe, it may be possible that Lux is not compatible with your browser. Lux is compatible with Google Chrome, but have not been extensively tested on Safari or Firefox.
- If you recieve the error message
A Jupyter widget could not be displayed because the widget state could not be found.This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the particular cell again. If this doesn’t work, then you may want try restarting the notebook and rerun the cell.
- If you receive the error message
ModuleNotFoundError: No module named 'luxwidget', it is possible that your luxwidget and lux-api versions are not in sync. The latest version of lux-api requires luxwidget v0.1 or above. Try running the following code:
- If you receive the error message
PermissionError: [Errno 13] Permission denied.during the execution of the command
jupyter nbextension install --py luxwidget, then you can add the flag
jupyter nbextension enable --py --user luxwidget).
- Alternatively, if none of the above works. You can try creating a fresh virtual environment and follow the quick install instructions.pip uninstall lux-api pip uninstall lux-widget jupyter nbextension uninstall --py luxWidget jupyter nbextension disable --py luxWidget pip install lux-api jupyter nbextension install --py luxwidget jupyter nbextension enable --py luxwidget
I’m not able to export my visualizations via the
- First, make sure that after selecting the visualization, you have clicked on the export button (attach screenshot)
- If you are recieving a warning message “No widget attached to the dataframe/VisList. Please assign dataframe/VisList to an output variable.” This means that the output widget that you exported your visualization on have not been stored to the variable that you are calling get_exported on. For example, you might have interacted with a widget directly by printing the results out.df.groupby("HighestDegree").sum()
You can resolve this issue by reassigning the dataframe or VisList output to a variable name, then exporting the visualization again based on the new widget.myOutput = df.groupby("HighestDegree").sum() myOutput
Then you should be able to access the exported visualizations by:myOutput.exported