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

If boxplot has 1 outlier, jitter moves the point all the way to the left. #2529

Closed
yniknafs opened this issue Apr 5, 2018 · 1 comment
Closed
Labels
bug something broken

Comments

@yniknafs
Copy link

yniknafs commented Apr 5, 2018

Love the boxplot feature, but found a corner case thats been difficult to pin down / debug. I think I've narrowed it down to an internal bug with plotly.

  • If there is only one outlier and jitter is turned on, the outlier point will render all the way in the top left corner of the plot.
  • If there are two outliers, this behavior goes away and the outliers are rendered normally.
  • Interestingly, if "all" is turned on, this bug also goes away.

I'm making a plot that really needs the jitter, and there have been multiple instances with a single outlier.

Here is a codepen recreating the issue, and showing the cases where it goes away:
Codepen

var trace_w_jitter = {
	boxpoints: 'outliers',
	jitter: '0.7',
	marker: {
		opacity: 0.5
	},
	type: 'box',
	x: ["w_jitter", "w_jitter", "w_jitter", "w_jitter", 
"w_jitter", "w_jitter", "w_jitter"],
	y: [46.505,0.143,0.649,0.059, 513,90,234]
}

var trace_w_jitter_all = {
	boxpoints: 'all',
	jitter: '0.7',
	pointpos: 0,
	marker: {
		opacity: 0.5
	},
	type: 'box',
	x: ["trace_w_jitter_all", "trace_w_jitter_all",
 "trace_w_jitter_all", "trace_w_jitter_all",
"trace_w_jitter_all", "trace_w_jitter_all", "trace_w_jitter_all"],
	y: [46.505,0.143,0.649,0.059, 513,90,234]
}

var trace_wo_jitter = {
	boxpoints: 'outliers',
	marker: {
		opacity: 0.5
	},
	type: 'box',
	x: ["wo_jitter", "wo_jitter", "wo_jitter", "wo_jitter", 
"wo_jitter", "wo_jitter", "wo_jitter"],
	y: [46.505,0.143,0.649,0.059, 513,90,234]
}

var trace_w_jitter_multioutlier = {
	boxpoints: 'outliers',
	marker: {
		opacity: 0.5
	},
	jitter: 0.6,
	type: 'box',
	x: ["w_jitter_multioutlier", "w_jitter_multioutlier","w_jitter_multioutlier", 
"w_jitter_multioutlier", "w_jitter_multioutlier", "w_jitter_multioutlier", 
"w_jitter_multioutlier", "w_jitter_multioutlier", "w_jitter_multioutlier", 
"w_jitter_multioutlier", "w_jitter_multioutlier"],
	y: [46.505,0.143,0.649,0.059, 513, 590,90,234,
		0,0,0]
}

var data = [trace_w_jitter, trace_w_jitter_all, trace_w_jitter_multioutlier, trace_wo_jitter, ];

var layout = {
  title: 'Box Plot Styling Outliers'
};

Plotly.newPlot('myDiv', data, layout);
@alexcjohnson
Copy link
Collaborator

Yep, that's a bug alright. Thanks for the very clear report! Made it nice and easy to find the problem.

@alexcjohnson alexcjohnson added the bug something broken label Apr 6, 2018
alexcjohnson added a commit that referenced this issue Apr 6, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix #2529 - box plot with one jittered outlier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants