How do I make a plot with errorbars using CeTZ plot?

I’m trying to plot data with errorbars. In cetz-plot, there is a function add-errobars, but there is no example, and I don’t understand the documentation.

For example:

plot.add-errorbar(
  x-error: ex,
  y-error: ey,
  (x, y),
)

This will draw an error bar on the plot centered at (x, y), with the x-direction error being ex and the y-direction error being ey. (If you don’t need the x-direction error, you can simply omit the x-error parameter.)

However, if you want to plot in bulk, for example, if you have a bar chart with many errors to display, you can use the error-key parameter of add-bar to achieve this. But you’ll need to pre-zip the x, y, and error data into the same array (or dict) and specify the positions of these three types of data within the array (or dict):

#import "@preview/cetz:0.3.1"
#import "@preview/cetz-plot:0.1.0"

#let m = (3, 1, 4, 1, 5, 9)
#let e = (2, 6, 5, 3, 5, 8).map(x => x * 0.1)

#let data = range(m.len()).zip(m, e)

#cetz.canvas({
  import cetz-plot: *
  plot.plot(
    size: (11, 5),
    {
      plot.add-bar(
        bar-width: .5,
        x-key: 0,
        y-key: 1,
        error-key: 2,
        data,
      )
    },
  )
})

I’m not interested in a bar plot, but a scatter plot with error bars.

Then use add-errorbar with a for loop.

Thanks! That works, but is quite annoying because it steps forward in the cycle of styles by default.