Frequently Asked Questions (FAQ)

General Information

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?

Lux has some limited support for SQL (currently only tested for Postgres). We are actively working on extending Lux to databases. If you are interested in using this feature, please contact us for more information.

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 recommendation property of the dataframe (e.g., df.recommendation).

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_display property 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?

By default, we make use of Altair to generate Vega-Lite visualizations. We can modify the plotting_backend config property to use Matplotlib as the plotting library instead:

lux.config.plotting_backend = "matplotlib"

To switch back to Vega-Lite:

lux.config.plotting_backend = "vegalite"

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_style property. 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.Clause specification. To override automatically inferred properties, you can specify additional arguements inside lux.vis.Clause to set the value of the Clause properties. See this page for more details.

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 lux statement 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_start and lux.config.sampling_cap. See this page for more details.

Troubleshooting Tips

To troubleshoot your Lux installation, we recommend cloning this repo and using one of the demo notebooks to test out Lux.

The Lux Jupyter widget does not show up when I print a dataframe.

To check if your luxwidget configuration is set up correctly, please run the following code in your notebook to debug:

import lux
lux.debug_info()

We recommend using a simple example to test if your widget is showing correctly:

import lux
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/college.csv")
df

If you receive the output message IPython shell not available., please run your code in a notebook interface such as Jupyter notebook, Jupyter Lab, JupyterHub, or VSCode.

If you receive the output message WARNING: luxwidget is not enabled in Jupyter Lab., run the following code in your terminal to enable luxwidget:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install luxwidget

If you receive the output message WARNING: luxwidget is not enabled in Jupyter Notebook., run the following code in your terminal to enable luxwidget:

jupyter nbextension install --py luxwidget
jupyter nbextension enable --py luxwidget

If the Lux Jupyter widget still does not show up, try the following:

  • If you receive 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 list on 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 --user (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 exported property.

  • 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

I have an issue that is not addressed by any of the FAQs.

Please submit a Github Issue or ask a question on Slack.