Skip to content

Errorbars for Measurements.jl #688

Open

Description

@Beforerr

Proposed solution

It would be nice for Errorbars to support 2 positional arguments for struct like Measurement in Measurements.jl).

I am wondering if the solution could be more general to support any struct.

Activity

  1. mangelmauriz commented on Sep 19, 2026

    @mangelmauriz

    Currently, the inability to use Measurement objects with this package is due to what seems to be an oversight in Measurements.jl. Specifically, AOG callstypemin on a Measurement for which no method is defined.

    I've already opened a Pull Request in the Measurements repository to address this. In the meantime, until the fix is merged, you can add the following after loading Measurements.

    Base.typemin(::Type{Measurements.Measurement{T}}) where {T<:AbstractFloat} = typemin(T)

    Example

    using CairoMakie
    using AlgebraOfGraphics
    using Measurements
    
    Base.typemin(::Type{Measurements.Measurement{T}}) where {T<:AbstractFloat} = typemin(T)
    x = collect(0:.5:4) .± .1
    y = sin.(x)
    
    plot = (
    	mapping(x,y) * visual(Scatter, color = :crimson) + 
    	mapping(x,y,x) * visual(Errorbars, color=:green, direction = :x, whiskerwidth = 10) +
    	mapping(x,y,y) * visual(Errorbars, color=:blue, direction = :y, whiskerwidth = 10)
    	)|>draw
    Image
  2. jkrumbiegel commented on Sep 20, 2026

    @jkrumbiegel
    Member

    interesting that this works, I guess it's a little by accident. AoG is not very good with foreign types that are connected to special recipes because the logic that AoG needs to run, determining scales with min and max, checking that different inputs work meaningfully together, is unaware of a later convert that Makie might run. mapping(x, y, x) is definitely a bit weird from AoG's perspective because it has no way of knowing that you mean the x value component with the first x but the x error component with the second. That just happens later in Makie unbeknownst to AoG

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions