-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Violin plots #2116
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
Violin plots #2116
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c578cde
replace gd.numboxes by fullLayout._numBoxes
etpinard 8f34227
replace 'emptybox' with 'empty' in box calc item
etpinard c8f38ff
factor out box defaults and boxpoint plot methods
etpinard 3438eae
first cut violin
etpinard d779509
first cut violin mocks
etpinard bb252a5
Merge branch 'master' into violins-dev
etpinard ea43b25
rename 'box' category 'box-violin'
etpinard a706f2a
factor out box/whiskers and mean/sd plotting routine
etpinard 1eb453b
split box hover into onBoxes and onPoints routines
etpinard 7769f20
implement violinmode, violingroup and violingroupgap
etpinard ad51966
2nd cut violin calc/plot attributes + improve violin curve paths
etpinard 4a40fc7
add findPointOnPath geometry2d util function
etpinard 6ffc379
implement violin 'inner' style options
etpinard dfa918f
pass hoverlayer to trace module hoverPoints
etpinard bc6bc02
implement violin hover
etpinard e737664
2nd cut violin mocks
etpinard e625c44
1st cut violin jasmine tests
etpinard 14bded3
fill violin attribute descriptions + fix typo in comment
etpinard 48758d8
fixup scalemode 'count' calculation
etpinard 17f65d0
add inner box and mean line to side-by-side violin mock
etpinard 71700de
2nd cut violin jasmine tests
etpinard 677aacc
remove 'kernel' from violin attributes
etpinard 0a32b98
update box and meanline attribute syntax
etpinard 3c9e0a0
add violin style mock
etpinard ea66dea
add editType to new violin attr containers
etpinard 789121c
update violin layout attr descriptions
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* 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'; | ||
|
||
module.exports = require('../src/traces/violin'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,25 @@ var Color = require('../../components/color'); | |
|
||
var attributes = require('./attributes'); | ||
|
||
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { | ||
function supplyDefaults(traceIn, traceOut, defaultColor, layout) { | ||
function coerce(attr, dflt) { | ||
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); | ||
} | ||
|
||
handleSampleDefaults(traceIn, traceOut, coerce, layout); | ||
if(traceOut.visible === false) return; | ||
|
||
coerce('line.color', (traceIn.marker || {}).color || defaultColor); | ||
coerce('line.width'); | ||
coerce('fillcolor', Color.addOpacity(traceOut.line.color, 0.5)); | ||
|
||
coerce('whiskerwidth'); | ||
coerce('boxmean'); | ||
|
||
handlePointsDefaults(traceIn, traceOut, coerce, {prefix: 'box'}); | ||
} | ||
|
||
function handleSampleDefaults(traceIn, traceOut, coerce, layout) { | ||
var y = coerce('y'); | ||
var x = coerce('x'); | ||
|
||
|
@@ -39,25 +53,22 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | |
handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); | ||
|
||
coerce('orientation', defaultOrientation); | ||
} | ||
|
||
coerce('line.color', (traceIn.marker || {}).color || defaultColor); | ||
coerce('line.width'); | ||
coerce('fillcolor', Color.addOpacity(traceOut.line.color, 0.5)); | ||
|
||
coerce('whiskerwidth'); | ||
coerce('boxmean'); | ||
function handlePointsDefaults(traceIn, traceOut, coerce, opts) { | ||
var prefix = opts.prefix; | ||
|
||
var outlierColorDflt = Lib.coerce2(traceIn, traceOut, attributes, 'marker.outliercolor'); | ||
var lineoutliercolor = coerce('marker.line.outliercolor'); | ||
|
||
var boxpoints = coerce( | ||
'boxpoints', | ||
var points = coerce( | ||
prefix + 'points', | ||
(outlierColorDflt || lineoutliercolor) ? 'suspectedoutliers' : undefined | ||
); | ||
|
||
if(boxpoints) { | ||
coerce('jitter', boxpoints === 'all' ? 0.3 : 0); | ||
coerce('pointpos', boxpoints === 'all' ? -1.5 : 0); | ||
if(points) { | ||
coerce('jitter', points === 'all' ? 0.3 : 0); | ||
coerce('pointpos', points === 'all' ? -1.5 : 0); | ||
|
||
coerce('marker.symbol'); | ||
coerce('marker.opacity'); | ||
|
@@ -66,7 +77,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | |
coerce('marker.line.color'); | ||
coerce('marker.line.width'); | ||
|
||
if(boxpoints === 'suspectedoutliers') { | ||
if(points === 'suspectedoutliers') { | ||
coerce('marker.line.outliercolor', traceOut.marker.color); | ||
coerce('marker.line.outlierwidth'); | ||
} | ||
|
@@ -77,4 +88,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | |
} | ||
|
||
coerce('hoveron'); | ||
} | ||
|
||
module.exports = { | ||
supplyDefaults: supplyDefaults, | ||
handleSampleDefaults: handleSampleDefaults, | ||
handlePointsDefaults: handlePointsDefaults | ||
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 made a separate reorganisation commit, to show a new way to factor out common trace module blocks. I think this method is a little more consistent with ES6 modules. For example here, |
||
}; |
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
Oops, something went wrong.
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.
Making sure violins are under boxes always.