You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plotting multiple line plots by passing a matrix of Quantities fails. Here's a demo and the error message
using Plots, UnitfulPlots
plotlyjs()
import Unitful: μm
a =rand(100)
a_um = a * μm
plot([a_um a_um]) #failsplot([a a]) #succeeds
ERROR: DimensionError: Inf and 0.8797156427357942 μm are not dimensionally compatible.
in expand_extrema!(::Plots.Extrema, ::Unitful.Quantity{Float64,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)},Unitful.FreeUnits{(Unitful.Unit{:Meter,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}(-6,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}}) at /home/cody/.julia/v0.5/Plots/src/axes.jl:239
in expand_extrema!(::Plots.Axis, ::Array{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}},1}) at /home/cody/.julia/v0.5/Plots/src/axes.jl:262
in expand_extrema!(::Plots.Subplot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}) at /home/cody/.julia/v0.5/Plots/src/axes.jl:289
in _expand_subplot_extrema(::Plots.Subplot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}, ::Symbol) at /home/cody/.julia/v0.5/Plots/src/pipeline.jl:361
in _process_seriesrecipe(::Plots.Plot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}) at /home/cody/.julia/v0.5/Plots/src/pipeline.jl:392
in _plot!(::Plots.Plot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}},2}}) at /home/cody/.julia/v0.5/Plots/src/plot.jl:227
in plot(::Array{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}},2}) at /home/cody/.julia/v0.5/Plots/src/plot.jl:46
The text was updated successfully, but these errors were encountered:
You might be able to fix this with a recipe, but if not you'll need to write a method Plots.expand_extrema!(::Plots.Extrema, ::Unitful.Quantity). In the method Plots.expand_extrema!(::Plots.Extrema, ::Number) there appears to be some comparison being done in a dimensionally unsound way since Plots.Extrema has Float64 fields. The fix is probably going to be pretty ugly until Plots.jl itself becomes dimensionally aware, I'd guess.
Plotting multiple line plots by passing a matrix of Quantities fails. Here's a demo and the error message
The text was updated successfully, but these errors were encountered: