lux-org / lux

Automatically visualize your pandas dataframe via a single print! 📊 💡
Apache License 2.0
5.15k stars 365 forks source link

FIX-#298: Abbrev long filter values and add to vis test #466

Closed labanyamukhopadhyay closed 2 years ago

labanyamukhopadhyay commented 2 years ago

Signed-off-by: Labanya Mukhopadhyay labanya@ponder.io

Overview

If a title is longer than 25 characters (due to a long filter value), it is abbreviated so the visualization is not exceedingly wide or have a title that is cut off. Referencing https://github.com/lux-org/lux/issues/298

Changes

The long text is truncated in both Altair and Matplotlib charts so that chart_title = chart_title[:15] + "..." + chart_title[-10:]. tests/test_vis.py also includes test_abbrev_title to test for this behavior.

Example Output

vis_test
codecov[bot] commented 2 years ago

Codecov Report

Merging #466 (74f9b3d) into master (3ca053d) will decrease coverage by 0.03%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
- Coverage   64.28%   64.24%   -0.04%     
==========================================
  Files          56       56              
  Lines        4572     4576       +4     
==========================================
+ Hits         2939     2940       +1     
- Misses       1633     1636       +3     
Impacted Files Coverage Δ
lux/vislib/matplotlib/MatplotlibChart.py 74.19% <0.00%> (-5.12%) :arrow_down:
lux/vislib/altair/AltairChart.py 85.07% <100.00%> (+0.45%) :arrow_up:
lux/vislib/altair/Heatmap.py 93.10% <0.00%> (-3.45%) :arrow_down:

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 3ca053d...74f9b3d. Read the comment docs.

dorisjlee commented 2 years ago

Nice work, thanks @labanyamukhopadhyay!