Skip to content

Can't plot Vector of Quantity with open ended child type #834

@luke-pikaart

Description

@luke-pikaart

This errors out when trying to ustrip() and uconvert():

using Plots, Unitful

x = 0:10

function foo(x) 
    if(x > 5) 
        return 1u"A"
    else 
        return 1.0u"A"
    end
end

y = foo.(x)

plot(y)

y is type Vector{Quantity{T, 𝐈, FreeUnits{(A,), 𝐈, nothing}} where T}

Is this the intended behavior? It seems like for the purposes of plotting we should try to be as flexible as possible and accept as many inputs as possible.

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