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

Issue 283 nano plot scaling #404

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

minimav
Copy link

@minimav minimav commented Jul 18, 2024

Summary

This PR fixes a bug whereby values from unselected rows affect the scaling in nanoplots. In addition to the single values case given in #283, a simple example of the bug in the context of multiple values per row is below (when autoscale is used):

multiple_vals_df = pd.DataFrame(
    {
        "i": list(range(1, 3)),
        "lines_small": ["12.44 6.34", "5.2 -8.2 10"],
        "lines_large": ["12.44, 6.34", "5.2 -8.2 100"],
    }
)
(
    GT(multiple_vals_df, rowname_col="i")
    .fmt_nanoplot(columns="lines_small", rows=[0], plot_type="line", autoscale=True)
    .fmt_nanoplot(columns="lines_large", rows=[0], plot_type="line", autoscale=True)
)
Screenshot 2024-07-18 at 20 49 20

Single values example post-fix:

Screenshot 2024-07-18 at 19 53 06

Multiple values example post-fix:

Screenshot 2024-07-18 at 19 53 29

I have added a couple of unit tests based on existing ones, let me know if they work. Thanks for your work on this library, I have been using it at work and really enjoying it 🙂

Related GitHub Issues and PRs

Checklist

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.64%. Comparing base (f8e30ea) to head (f1df81e).

Files Patch % Lines
great_tables/_formats.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
+ Coverage   86.40%   86.64%   +0.24%     
==========================================
  Files          42       42              
  Lines        4700     4704       +4     
==========================================
+ Hits         4061     4076      +15     
+ Misses        639      628      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants