Skip to content

Commit

Permalink
add config for changing heatmap bin size
Browse files Browse the repository at this point in the history
  • Loading branch information
dorisjlee committed Feb 7, 2021
1 parent 13af5cb commit dfb9bce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions doc/source/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,14 @@ If you would like to turn off the selection criteria completely and display ever
lux.config.topk = False
Beware that this may generate large numbers of visualizations (e.g., for 10 quantitative variables, this will generate 45 scatterplots in the Correlation action!)

Changing heatmap bin resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In Lux, large scatterplots are displayed as heatmaps that are 40x40 by default. You can increase or decrease the heatmap resolution NxN by changing the bin size N:

.. code-block:: python
lux.config.heatmap_bin_size = 100
This generates heatmap visualizations that are binned into a 100x100 grid.
1 change: 1 addition & 0 deletions lux/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self):
self._sort = "descending"
self._pandas_fallback = True
self._interestingness_fallback = True
self.heatmap_bin_size = 40

@property
def topk(self):
Expand Down
4 changes: 2 additions & 2 deletions lux/executor/PandasExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ def execute_2D_binning(vis: Vis):
x_attr = vis.get_attr_by_channel("x")[0].attribute
y_attr = vis.get_attr_by_channel("y")[0].attribute

vis._vis_data["xBin"] = pd.cut(vis._vis_data[x_attr], bins=40)
vis._vis_data["yBin"] = pd.cut(vis._vis_data[y_attr], bins=40)
vis._vis_data["xBin"] = pd.cut(vis._vis_data[x_attr], bins=lux.config.heatmap_bin_size)
vis._vis_data["yBin"] = pd.cut(vis._vis_data[y_attr], bins=lux.config.heatmap_bin_size)

color_attr = vis.get_attr_by_channel("color")
if len(color_attr) > 0:
Expand Down

0 comments on commit dfb9bce

Please sign in to comment.