Skip to content

Box plot with log axis results in log-scaled box widths #3508

Description

@jonmmease

Originally reported in plotly/plotly.py#1415

When plotting a box plot on a log axis, the box widths seem to follow the log pattern.

CodePen: plotly/plotly.py#1415

var y0=[],y1=[]
for ( i = 0; i < 50; i ++) 
{
	y0[i] = Math.random();
	y1[i] = Math.random();
}

var trace1 = {
	x: y0.map(v => 1),
   y: y0,
  type: 'box'
};

var trace2 = {
  x: y0.map(v => 10),
  y: y1,
  type: 'box'
};

var trace3 = {
  x: y0.map(v => 100),
  y: y1,
  type: 'box'
};

var data = [trace1, trace2, trace3];
var layout = {xaxis: {type: 'log'}}

Plotly.newPlot('myDiv', data, layout, {showSendToCloud: true});

newplot

Since the width of the boxes is not a value in data coordinates, it seems to me that we shouldn't scale it according to the log axis transform. What do you think?

Activity

  1. KonradTUM commented on Feb 6, 2019

    @KonradTUM

    It would be really useful to input a box width in pixel. So it would be possible to output plots with different axis scales but same look. Don't know how to achieve this at the moment.

  2. etpinard commented on Feb 6, 2019

    @etpinard
    Contributor

    @KonradTUM

    It would be really useful to input a box width in pixel.

    Maybe try the new box width attribute added in #3234

  3. etpinard commented on Feb 6, 2019

    @etpinard
    Contributor

    Thanks @jonmmease I never tried plotting a box trace on a log position axis. Good to know!

  4. s417-lama commented on Oct 16, 2019

    @s417-lama
    Contributor

    I fixed this issue in s417-lama#1 .
    Would you review the PR? @etpinard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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