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

Set rescale_discrete_levels=True by default #5268

Merged
merged 6 commits into from
May 26, 2022
Merged

Conversation

jbednar
Copy link
Member

@jbednar jbednar commented Apr 8, 2022

The eq_hist colormapper used with Datashader is designed for large datasets with a wide distribution of values, but as documented in holoviz/datashader#357 the behavior when there are only a few distinct value levels has always been confusing and misleading. Datashader 0.14 adds an option rescale_discrete_levels=True, now supported in HoloViews, allowing users to avoid this issue. However, this option is False by default, and most users are never going to be aware that the option exists. This PR enables the option by default, which has good and bad consequences:

  • Good: Users will now see better colormapping behavior, with points visible at all zoom levels and no longer jumping between the lowest and highest colormap values at a tiny change in zoom level, without having to learn about this option or modify any of their code. This is arguably a long-overdue bug fix.
  • Bad: Results will change for plots rendered with eq_hist that have only a small number of discrete levels. That's by design, but it is strictly a compatibility change, which is odd to introduce in a patch release.
  • Bad: Results will differ between rasterize and datashade, because Bokeh does not yet support rescale_discrete_levels. So there is some argument for waiting until Bokeh does support it to make this the default.

Basically, if we consider this a bugfix, we should introduce it now; patch releases are for bugfixes. If we consider it a new feature, we should wait until the next major or at least minor release to enable it by default.

I'm ok with either option, as long as the options have been duly considered and decided between.

@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2022

Codecov Report

Merging #5268 (f058770) into master (c265cc1) will decrease coverage by 0.11%.
The diff coverage is 16.66%.

@@            Coverage Diff             @@
##           master    #5268      +/-   ##
==========================================
- Coverage   86.74%   86.62%   -0.12%     
==========================================
  Files         299      299              
  Lines       62218    62281      +63     
==========================================
- Hits        53969    53950      -19     
- Misses       8249     8331      +82     
Impacted Files Coverage Δ
holoviews/plotting/mpl/util.py 76.12% <3.22%> (-1.35%) ⬇️
holoviews/operation/datashader.py 78.33% <100.00%> (-1.72%) ⬇️
holoviews/plotting/mpl/element.py 89.95% <100.00%> (-0.07%) ⬇️
holoviews/plotting/mpl/raster.py 78.52% <0.00%> (-3.51%) ⬇️
holoviews/plotting/util.py 69.49% <0.00%> (-2.06%) ⬇️
holoviews/plotting/bokeh/raster.py 71.30% <0.00%> (-0.95%) ⬇️
holoviews/tests/plotting/bokeh/test_callbacks.py 97.82% <0.00%> (-0.30%) ⬇️
holoviews/tests/plotting/bokeh/test_server.py 97.59% <0.00%> (-0.17%) ⬇️
holoviews/plotting/bokeh/callbacks.py 59.60% <0.00%> (-0.15%) ⬇️
... and 4 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 c265cc1...f058770. Read the comment docs.

@maximlt maximlt changed the title Set rescale_default_values=True by default Set rescale_discrete_levels=True by default May 18, 2022
@maximlt
Copy link
Member

maximlt commented May 18, 2022

@jbednar should this also be merged before 1.15.0?

@jbednar
Copy link
Member Author

jbednar commented May 18, 2022

Yes

1 similar comment
@jbednar
Copy link
Member Author

jbednar commented May 18, 2022

Yes

Co-authored-by: Maxime Liquet <35924738+maximlt@users.noreply.github.com>
@jbednar
Copy link
Member Author

jbednar commented May 26, 2022

Bokeh 2.4.3 EqHistColorMapper now supports rescale_discrete_levels, so I think this PR should now be merged. Do we need to do anything so that the same default applies in the Bokeh case?

@philippjfr
Copy link
Member

Already seems to be true in the bokeh case, but really we need to implement it for matplotlib.

Copy link
Member Author

@jbednar jbednar left a comment

Choose a reason for hiding this comment

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

The MPL changes look good, thanks!

holoviews/plotting/mpl/element.py Outdated Show resolved Hide resolved
holoviews/plotting/mpl/util.py Show resolved Hide resolved
@philippjfr philippjfr merged commit d6fa177 into master May 26, 2022
@philippjfr philippjfr deleted the rescaledefault branch May 26, 2022 18:02
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants