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

Error bars not scaled correctly in logarithmic 3D plots #1139

Closed
jdieg0 opened this issue Aug 29, 2018 · 3 comments
Closed

Error bars not scaled correctly in logarithmic 3D plots #1139

jdieg0 opened this issue Aug 29, 2018 · 3 comments
Labels
bug plotly.js Issues that would require plotly.js changes
Milestone

Comments

@jdieg0
Copy link

jdieg0 commented Aug 29, 2018

Hi,

generating a Scatter plot with a logarithmic y axis and given error_y works fine whereas creating a similar plot with Scatter3d with error bars results in extremely large error bars. The proportions of the error bars in the 3D plot are correct if type='log' is omitted.

Example:

#!/usr/bin/env python3
# encoding=utf-8

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.offline

import numpy as np

measurements = list(range(3))
x = np.array(range(10))
z = np.array([10**i for i in range(10)])
z_errors = z * 0.3

# 2D plot
trace = [go.Scatter(
	x = x,
	y = z,
	error_y = dict(
		type = 'data',
		array = z_errors,
		visible = True,
	),
)]

layout = go.Layout(
	yaxis = dict(
		type = 'log',
	),
)

fig = go.Figure(data=trace, layout=layout)
plotly.offline.plot(fig, filename='example_2d.html')

# 3D plot
traces = [go.Scatter3d(
	x = x,
	y = [constant] * len(x),
	z = z,
	error_z = dict(
		type = 'data',
		array = z_errors,
		visible = True,
	),
) for constant in measurements]

layout = go.Layout(
	scene = dict(
		zaxis = dict(
			type 	= 'log',
		),
	)
)

fig = go.Figure(data=traces, layout=layout)
plotly.offline.plot(fig, filename='example_3d.html')

Results:

2D (type='log')
example_2d

3D (type='log')
example_3d

3D
example_3d_no_log

@jonmmease
Copy link
Contributor

Thanks for the report @jdieg0 ,

This will need to be handled in the Plotly.js project, and I've opened a corresponding issue there at plotly/plotly.js#2962.

@jonmmease jonmmease added bug plotly.js Issues that would require plotly.js changes labels Sep 1, 2018
@jonmmease
Copy link
Contributor

Fixed in plotly/plotly.js#2992. And it looks like this will line up for inclusion in plotly.py 3.4

@jonmmease jonmmease added this to the v3.4.0 milestone Sep 23, 2018
@jonmmease
Copy link
Contributor

Closing as this was fixed in plotly.js and will be included in plotly.py 3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plotly.js Issues that would require plotly.js changes
Projects
None yet
Development

No branches or pull requests

2 participants