-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Contour bug #1309
Contour bug #1309
Changes from all commits
a004e40
4f5de76
f140629
ebaaca3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* 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'; | ||
|
||
/* | ||
* tiny helper to move the end of the contours a little to prevent | ||
* losing the last contour to rounding errors | ||
*/ | ||
module.exports = function endPlus(contours) { | ||
return contours.end + contours.size / 1e6; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,13 +84,13 @@ function makePath(pi, loc, edgeflag) { | |
if(equalPts(pts[pts.length - 1], pts[pts.length - 2])) pts.pop(); | ||
locStr = loc.join(','); | ||
|
||
var atEdge = (marchStep[0] && (loc[0] < 0 || loc[0] > n - 2)) || | ||
(marchStep[1] && (loc[1] < 0 || loc[1] > m - 2)), | ||
closedLoop = (locStr === startLocStr) && (marchStep.join(',') === startStepStr); | ||
|
||
// have we completed a loop, or reached an edge? | ||
if((locStr === startLocStr && marchStep.join(',') === startStepStr) || | ||
(edgeflag && ( | ||
(marchStep[0] && (loc[0] < 0 || loc[0] > n - 2)) || | ||
(marchStep[1] && (loc[1] < 0 || loc[1] > m - 2))))) { | ||
break; | ||
} | ||
if((closedLoop) || (edgeflag && atEdge)) break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could revert this change actually, as I don't need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your call here. I'm fine with it either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, if we're worried about perf, I should get rid of all those |
||
|
||
mi = pi.crossings[locStr]; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"x": [0, 5], | ||
"y": [0, 4], | ||
"z": [[4, 3], [2, 1]], | ||
"type": "contour", | ||
"contours": { | ||
"start": 1.1, | ||
"end": 4.09, | ||
"size": 1 | ||
}, | ||
"colorbar": {"x": 0.4, "y": 0.9, "len": 0.2} | ||
}, | ||
{ | ||
"x": [0, 5], | ||
"y": [0, 4], | ||
"z": [[4, 3], [2, 1]], | ||
"type": "contour", | ||
"contours": { | ||
"start": 1, | ||
"end": 4, | ||
"size": 0.9999999 | ||
}, | ||
"colorbar": {"x": 1, "y": 0.9, "len": 0.2}, | ||
"xaxis": "x2" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 0, 9, 0, 0, 0], | ||
[0, 0, 0, 0, 0, 0], | ||
[0, 0, 0, -9, 0, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.000001, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 0.4, "y": 0.65, "len": 0.2}, | ||
"yaxis": "y2" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 0, 9, -9, 0, 0], | ||
[0, 0, 9, -9, 0, 0], | ||
[0, 0, 9, -9, 0, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.000001, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 1, "y": 0.65, "len": 0.2}, | ||
"xaxis": "x2", | ||
"yaxis": "y2" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 9, 0, 0, 0, 0], | ||
[0, 0, 0, 0, 0, 0], | ||
[0, 0, 0, 0, -9, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.000001, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 0.4, "y": 0.4, "len": 0.2}, | ||
"yaxis": "y3" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 0, -9, 0, 0, 0], | ||
[0, 0, 0, 0, 0, 0], | ||
[0, 0, 0, 9, 0, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.0000005, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 1, "y": 0.4, "len": 0.2}, | ||
"xaxis": "x2", | ||
"yaxis": "y3" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 9, 0, 0, 0, 0], | ||
[0, 0, 0, 0, 0, 0], | ||
[0, 0, 0, 0, -9, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.0000005, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 0.4, "y": 0.15, "len": 0.2}, | ||
"yaxis": "y4" | ||
}, | ||
{ | ||
"z": [[0, 0, 0, 0, 0, 0], | ||
[0, 0, 9, 0, 0, 0], | ||
[0, -9, -9, -9, -9, 0], | ||
[0, 0, 0, 9, 0, 0], | ||
[0, 0, 0, 0, 0, 0]], | ||
"type": "contour", | ||
"contours": { | ||
"start": -0.0000005, | ||
"end": 0.000001, | ||
"size": 0.000001 | ||
}, | ||
"colorbar": {"x": 1, "y": 0.15, "len": 0.2}, | ||
"xaxis": "x2", | ||
"yaxis": "y4" | ||
} | ||
], | ||
"layout": { | ||
"xaxis": {"domain": [0, 0.4]}, | ||
"xaxis2": {"domain": [0.6, 1]}, | ||
"yaxis": {"domain": [0.8, 1]}, | ||
"yaxis2": {"domain": [0.55, 0.75]}, | ||
"yaxis3": {"domain": [0.3, 0.5]}, | ||
"yaxis4": {"domain": [0.05, 0.25]}, | ||
"width": 600, | ||
"height": 800 | ||
} | ||
} |
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.
colorbar
actually adds some more toend
for the same purpose - but it turns out not to matter in this case, additional expansion doesn't have any ill effects that I could find, as long as it always ends up at or beyond the level we used to make thecolorscale
. Sometime though we may want to fold ALL the places we extend a range a little for rounding purposes into the sameendPlus
mold.