Updating the error bars with the Line2D artist


There’s a very nice feature with Line2D artists, that allow me to change my xdata and ydata without having to refresh the plot. We use this in the application that when changing data.

I was trying to look into adding error bar functionalities, which works quite well, but the error bars don’t update with the artists. See video here below:


When changing to dark mode, I do trigger a refresh of the plot, hence the bars updating then. But it doesn’t do that before.

Is there any method to update the error bars after changing the lines without doing a re-render? I’ve seen some old PR’s and issues for that, but haven’t found a way to properly do this. Could anyone help me out?

So basically I’m just setting the using curve = axes.errorbar(x, y, yerr), and then I’m changing the data using e.g. curve[0].set_ydata(new_ydata). What I want is that the error bars automatically adjusts as well. Or at least a way to do this, so like a set_data method for the error bars without having to redraw the figure. I’ve tried many solutions I found online, but all rely on a manual redrawing of the figure which is what I wanted to prevent ideally.

Can you provide some example code showing what you are trying to do?