-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Carpet plot rebase #1595
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
Carpet plot rebase #1595
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
eee837f
Add ensure array lib function to allocate/resize
rreusser 5a0b788
Add axis cartesian axis visibility option
rreusser 89e095e
Add measureText function to drawing
rreusser e1a0417
Tweak showscale to allow unset (instead of strictly false)
rreusser 620cd43
Contour plot lines to use non-scaling stroke
rreusser 728a6f4
Genericize heatmap xyz variable names
rreusser c2994e7
More carefully track legend trace isolation indices
rreusser fe9850c
Add optional overrides to contour handleStyleDefaults
rreusser d1f2258
Genericize tolerances in find_all_paths to make way for carpet
rreusser 4bcf438
Add flag to disable scatter marker culling (needed for carpet)
rreusser 6b896d8
Tweak contour colorscale logic since carpet may set infinities
rreusser b8c71e1
Add group to plot
rreusser e4971ef
Carpet plots
rreusser c98553a
make rreusser's carpet tests pass
etpinard 71b96f3
add a few carpet interaction tests
etpinard bc1c5c8
:hocho: arraytools dep (sorry @bpostlethwaite)
etpinard 9c76d7a
exit early in axis defaults when visible is false
etpinard 85d6b8a
add axis `visible: false` mock
etpinard 54f092d
implement axis visible in 3D
etpinard d9cb011
add 3d axis `visible: false` mock
etpinard f1e8aee
Merge pull request #1596 from plotly/carpet-test-etienne
etpinard bc0f890
extendFlat -> slice
etpinard c2a7092
Merge pull request #1599 from plotly/axis-visible-3d
etpinard 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright 2012-2017, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* | ||
* Ensures an array has the right amount of storage space. If it doesn't | ||
* exist, it creates an array. If it does exist, it returns it if too | ||
* short or truncates it in-place. | ||
* | ||
* The goal is to just reuse memory to avoid a bit of excessive garbage | ||
* collection. | ||
*/ | ||
module.exports = function ensureArray(out, n) { | ||
if(!Array.isArray(out)) out = []; | ||
|
||
// If too long, truncate. (If too short, it will grow | ||
// automatically so we don't care about that case) | ||
out.length = n; | ||
|
||
return out; | ||
}; |
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.
huh, never knew you could resize this way!
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.
Best I can tell, it's actually robust and supported across platforms. It's possible it does weird things internally (like not actually de-allocating that memory. I saw a while ago some discussion of the various internal string apis and string data structures in js. Hint: it's not straightforward). The main goal was to just overwrite the carpet spline stuff rather than allocating everything from scratch every time since that adds up to lots of garbage collection.
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.
From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/length
That's right, [..] sets or returns [..].
It's not a read-only property like one might assume.
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.
(best-case scenario though is that it actually truncates in-place without actually copying. I mean maybe copies, but
slice()
definitely copies.)