plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Implement error bars on date axis

Open jonmmease opened this issue 6 years ago • 9 comments

Originally reported in https://github.com/plotly/plotly.py/issues/1488

Here's an example that specifies error_x and flips between setting the xaxis.type property between 'date' and 'linear'.

CodePen: https://codepen.io/jonmmease/pen/zXrmOK

var fig = {
  "data": [
    {
      "error_x": {
        "array": [
          100000.0,
          100000.0,
          100000.0
        ],
        "type": "data",
        "visible": true
      },
      "type": "scatter",
      "x": [
        1554370371547.085,
        1554370471547.085,
        1554370571547.085
      ],
      "y": [
        6,
        10,
        2
      ]
    }
  ],
  "layout": {
    "xaxis": {
      "type": "linear"
      // "type": "date"
    }
  }
}

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

with xaxis.type: 'linear': newplot-7

with xaxis.type: 'date': newplot-6

jonmmease avatar Apr 04 '19 09:04 jonmmease

Looks like we never implemented error bars on date axes:

https://github.com/plotly/plotly.js/blob/07822743b03e9bc1a3decd429c02b0452af49732/src/components/errorbars/calc.js#L37

etpinard avatar Apr 04 '19 15:04 etpinard

still nothing? need it very much for lightcurves :(

Barsoomx avatar Oct 10 '19 12:10 Barsoomx

Any updates on this? Workarounds? I just got a graph I am supposed to make that uses error bars on dates. I guess I can simply draw lines as a separate plot (if there is a way to keep it out of the legend?), but that seems kludgy...

ibrewster avatar Mar 02 '23 17:03 ibrewster

@ibrewster I think I eventually got around this using a gantt chart style plot, FYI. I think it's a kinda odd use case. Unsure if that will work for the generic case but hope that helps.

tomaszps avatar Mar 02 '23 18:03 tomaszps

Chiming in that this would also be useful when charting user-recorded data points, we have a lot of uncertainty about when exactly events happened and want to show error bars

James-Firth avatar Oct 25 '23 17:10 James-Firth

Do I understand correctly that when this bug is fixed, it will work in python plotly also?

sherdim avatar Jul 22 '24 15:07 sherdim

yes, but I expect it will be some time before it gets to the head of our queue :-/

gvwilson avatar Jul 22 '24 15:07 gvwilson

Dang I just spend hours trying to figure out why it wasn't working by trying to debug the minified source code just to find this thread that it has never been implemented with dates 💀. At least I didn't spend even longer than that . But now what.. Do I need to implement this myself?

mshvarts avatar Oct 03 '25 17:10 mshvarts

I would suggest to everyone who looks at this thread in the future to just use the gant chart functions.

-Tomasz

On Fri, Oct 3, 2025, 10:41 AM Max @.***> wrote:

mshvarts left a comment (plotly/plotly.js#3722) https://github.com/plotly/plotly.js/issues/3722#issuecomment-3366625027

Dang I just spend 3 hours trying to figure out why by trying to debug and decipher minified source code just to find that it has never been implemented with dates 💀 wow. At least I didn't spend even longer than that

— Reply to this email directly, view it on GitHub https://github.com/plotly/plotly.js/issues/3722#issuecomment-3366625027, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJY7LEAYMTVZRQ6QCZPUFUL3V2YLPAVCNFSM6AAAAACIHJDKJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNRWGYZDKMBSG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tomaszps avatar Oct 05 '25 22:10 tomaszps