Skip to content

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

Closed
@jonmmease

Description

@jonmmease

Plotly.js translation of plotly/plotly.py#1139 reported by @jdieg0

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.

Codepen: https://codepen.io/anon/pen/YOZyQq

In scatter the error bars work as expected.

// ## Constants
var x = [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]
var y = x.map(function() {return 0})
var z = [1.e+00, 1.e+01, 1.e+02, 1.e+03, 1.e+04,
         1.e+05, 1.e+06, 1.e+07, 1.e+08, 1.e+09]

var error_z = [3.e-01, 3.e+00, 3.e+01, 3.e+02, 3.e+03, 
               3.e+04, 3.e+05, 3.e+06, 3.e+07, 3.e+08]

// ## Scatter 2D
var scatter = {
  'type': 'scatter',
  'error_y': {'array': error_z,
              'type': 'data',
              'visible': true
             },
  'x': x,
  'y': z
}

var layout = {'yaxis': {'type': 'log', 'title': 'z'},
              'xaxis': {'title': 'x'},
              'width': 800,
              'height': 800};

var data = [ scatter ];

// ## Plot scatter 2D
Plotly.newPlot('myDiv', data, layout);

newplot-3

In scatter3d the errors bars grow very large

var scatter3d = {
  'type': 'scatter3d',
  'error_z': {'array': error_z,
              'type': 'data',
              'visible': true
             },
  'x': x,
  'y': y,
  'z': z
}

var data3d = [ scatter3d ];
var layout3d = {'scene': {'zaxis': {'type': 'log'}},
                'width': 800,
                'height': 800};

// ## Plot scatter 3D
Plotly.newPlot('myDiv', data3d, layout3d);

newplot-4

Perhaps error_z.type='data' is not implemented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions