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

[Altair] Sync exported histogram code with new bin determination #304

Merged
merged 37 commits into from
Mar 15, 2021

Conversation

micahtyong
Copy link
Member

@micahtyong micahtyong commented Mar 13, 2021

In this PR

Closes #302 by syncing up the new histogram bin determination rules from #285 into the Altair exported code.

Changes

  • Modifications in altair/Histogram.py and test_vis.py

Example Output

Employee Dataset: Distribution

Following the example in #302, upon running,

df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/employee.csv")
series = df["YearsAtCompany"]/df["TotalWorkingYears"]
series

then exporting our graph,

print(series.exported[0].to_code("altair"))

we now get the following output:
Screen Shot 2021-03-12 at 6 44 27 PM

Olympic Dataset: Occurrence

The output is also as expected for displaying categorical distributions using the y-axis. For example, running

df = pd.read_csv("https://github.com/lux-org/lux-datasets/blob/master/data/olympic.csv?raw=True")
df

then selecting the second graph from the Occurrence tab and exporting with

print(df.exported[0].to_code("altair"))

we now get the following output:
Screen Shot 2021-03-12 at 6 49 24 PM

micahtyong and others added 30 commits January 15, 2021 13:23
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
@micahtyong micahtyong closed this Mar 13, 2021
@micahtyong micahtyong deleted the binned-charts branch March 13, 2021 03:22
@micahtyong micahtyong restored the binned-charts branch March 13, 2021 03:22
@micahtyong micahtyong reopened this Mar 13, 2021
@micahtyong micahtyong changed the title Binned charts [Altair] Sync exported histogram code with new bin determination Mar 13, 2021
@codecov
Copy link

codecov bot commented Mar 13, 2021

Codecov Report

Merging #304 (c6a00e0) into master (14c141b) will increase coverage by 3.50%.
The diff coverage is 90.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #304      +/-   ##
==========================================
+ Coverage   77.58%   81.08%   +3.50%     
==========================================
  Files          40       50      +10     
  Lines        2846     3569     +723     
==========================================
+ Hits         2208     2894     +686     
- Misses        638      675      +37     
Impacted Files Coverage Δ
lux/action/column_group.py 92.59% <ø> (-3.71%) ⬇️
lux/action/enhance.py 100.00% <ø> (ø)
lux/action/filter.py 91.66% <ø> (ø)
lux/action/generalize.py 80.95% <ø> (ø)
lux/action/row_group.py 95.45% <ø> (ø)
lux/vislib/matplotlib/MatplotlibChart.py 79.31% <79.31%> (ø)
lux/core/frame.py 70.16% <80.00%> (+0.14%) ⬆️
lux/interestingness/interestingness.py 86.48% <80.00%> (-0.22%) ⬇️
lux/vislib/matplotlib/ScatterChart.py 80.30% <80.30%> (ø)
lux/vis/Vis.py 74.85% <81.25%> (+1.34%) ⬆️
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14c141b...86eaac2. Read the comment docs.

@dorisjlee dorisjlee merged commit 1c93057 into lux-org:master Mar 15, 2021
@dorisjlee
Copy link
Member

Thanks @micahtyong !

@micahtyong micahtyong deleted the binned-charts branch March 17, 2021 18:45
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.

[BUG] Exported histogram bin size set incorrectly
2 participants