Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Data Type + Action: Automatic geographic attribute visualizations #253

Merged
merged 31 commits into from
Mar 5, 2021

Conversation

micahtyong
Copy link
Member

@micahtyong micahtyong commented Feb 6, 2021

In this PR

Closes #123 by adding a new data type, geographical, which detects columns representing geographic attributes (e.g. state, country), then calls the default action, univariate, which then aggregates quantitative attributes and displays the corresponding choropleth symbol map.

Changes

  • Addition of new geographical datatype
  • Modified the univariate default action and added SymbolMap visualization
  • Utilizes existing aggregations from PandasExecutor.py
  • Tests in tests/test_type.py, tests/test_action.py, and test_vegalite_default_actions_registered for correctness and failure cases

Example Output

Screen Shot 2021-02-20 at 6 03 58 PM

@micahtyong
Copy link
Member Author

cc: @dorisjlee. Just worked through this issue! Lux can now detect and visualize geographical attributes. I may have pulled upstream changes in a way s.t. this PR includes merged commits from other PRs, but the logic from those remains unchanged. Let me know if there are changes I might need to make. I hope this helps!

lux/executor/Executor.py Outdated Show resolved Hide resolved
lux/executor/Executor.py Outdated Show resolved Hide resolved
tests/test_type.py Outdated Show resolved Hide resolved
lux/action/map.py Outdated Show resolved Hide resolved
tests/test_vis.py Outdated Show resolved Hide resolved
@micahtyong micahtyong self-assigned this Feb 12, 2021
dorisjlee added a commit that referenced this pull request Feb 17, 2021
lux/interestingness/interestingness.py Show resolved Hide resolved
lux/vislib/altair/SymbolMap.py Outdated Show resolved Hide resolved
lux/vislib/altair/SymbolMap.py Outdated Show resolved Hide resolved
lux/utils/utils.py Show resolved Hide resolved
@micahtyong
Copy link
Member Author

Hi @dorisjlee, I've added the ability to export choropleths, as requested. An example output is shown below. Let me know if there's anything else I should modify!

Screen Shot 2021-02-25 at 1 13 50 AM

@dorisjlee
Copy link
Member

Hi @micahtyong,
This looks really great! I tried this out on the Covid dataset that we worked on a while back and the maps look really cool with the different measure values in the dataset.

df = pd.read_csv("https://github.com/covidvis/covid19-vis/blob/master/data/interventionFootprintByState.csv?raw=True",index_col=0)
df['dateBefore'] = pd.to_datetime(df['dateBefore'], format='%Y-%M-%d')
df

image
One thing that I did notice from this dataset is that when we click on the visualization, there is a lot of "jitter" that happen with the plots being redrawn.
Feb-27-2021 21-49-24
I believe this is related to lux-widget:#63. This re-drawing issue is present for all charts, but perhaps because the map vis takes longer to draw, so the jitter looks more off. This is a bigger issue that should be addressed separately, so I think we should be good to merge this issue independent of this.

I'll wait until @caitlynachen does a code review on this PR before merging this in.
Thanks!

Copy link
Contributor

@caitlynachen caitlynachen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Maybe next steps is to work on the same geo feature for Matplotlib, but amazing job figuring it out for Altair!

@dorisjlee dorisjlee merged commit 47ef480 into lux-org:master Mar 5, 2021
@dorisjlee
Copy link
Member

dorisjlee commented Mar 5, 2021

Thanks @micahtyong! Feel free to open new issues on some of the next steps that we discussed for extending the geo vis features (e.g., matplotlib, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Action: Automatic geographic attribute visualizations
3 participants