-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement fast zsmooth option for image trace #5354
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0db886c
Add Image.interpolate property
almarklein e4cfb61
change to enumeration
almarklein 0eaabaf
keep dflt in attributes
almarklein 0bf264c
implement suggestion
almarklein 1b53120
Update src/traces/image/defaults.js
almarklein 8f0b0f1
Update src/traces/image/attributes.js
almarklein 33ab959
Update src/traces/image/attributes.js
almarklein a3eff71
Update src/traces/image/attributes.js
almarklein bd28585
Update src/traces/image/attributes.js
almarklein d9210c3
Merge branch 'master' into interp
almarklein 6dcb840
put pixelated style in constants
almarklein 8b39030
add to docstring
almarklein 5b01253
style
almarklein 15d157f
fix css
almarklein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heatmap trace has
['fast', 'best', false]
. I'm not sure whatfalse
means there, but would it not make more sense to have 'fast' and 'best' here, which would resolve to pixelated and "auto", respectively?We should also add a note that the result may be browser dependent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, we really need better documentation of those options for heatmaps, but here's what they mean:
false
means no smoothing, each data point is a rectangle (or "brick") of constant color.'fast'
means we let the browser interpolate smoothly between one data value and the next (so yes, the result may be browser-dependent). This only works when all pixels are the same size, and it can cause problems if two neighboring points have very different value, as the browser will probably interpolate linearly in RGB space and intermediate values may not be present in the colorscale at all.'best'
means we smooth by calculating the color at each screen pixel independently, first with bilinear interpolation of data values, then we map the result onto the colorscale. This can be slow, but it handles nonuniform x or y spacing and ensures every interpolated value is in the colorscale.So what you've implemented here - assuming the browser behaves as expected - corresponds to
false
(pixelated) and'fast'
(smoothed).'best'
probably doesn't make sense for images unless there are important browsers that we can't get to behave correctly with'fast'
. But we don't support nonuniform pixels in image traces, and there's no colorscale so the interpolation we would do manually is likely the same as the browser does, unless perhaps we wanted to support interpolating in HSL space.