JuliaPhysics / JuliaPhysics/Unitful.jl

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

Open
#834 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
675
Forks
124
Avg merge
3h 38m
Merged PRs (30d)
1

Description

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

```julia
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided Plots and Unitful example and inspect the ustrip() and uconvert() paths that receive the Vector{Quantity{T, 𝐈, FreeUnits{(A,), 𝐈, nothing}} where T} value. Done means determining whether plotting should accept this open-ended child type and, if so, verifying that the example plots successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.