Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not plot vectors of #4

Open
ChrisRackauckas opened this issue Oct 18, 2016 · 0 comments
Open

Does not plot vectors of #4

ChrisRackauckas opened this issue Oct 18, 2016 · 0 comments

Comments

@ChrisRackauckas
Copy link

Might want to get @tbreloff in on this one. The recipe found here https://github.com/JuliaDiffEq/DifferentialEquations.jl/blob/master/src/general/plotrecipes.jl#L39 can be simplified in this case to the following:

@recipe function f(sol::AbstractODESolution;plot_analytic=false,denseplot=true,plotdensity=100)
  plotseries = Vector{Any}(0)
  plot_timeseries = sol.timeseries
  push!(plotseries,plot_timeseries)
  plott = sol.t
  plott, plotseries
end

This fails (presumably because Plots cannot handle the units?)

MethodError: no method matching isless(::Float64, ::Unitful.Quantity{Float64,Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)},Unitful.Units{(Unitful.Unit{:Second}(0,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)}}})
Closest candidates are:
  isless(::Float64, !Matched::Float64) at float.jl:415
  isless(::AbstractFloat, !Matched::AbstractFloat) at operators.jl:75
  isless(::Real, !Matched::AbstractFloat) at operators.jl:76
  ...
 in expand_extrema!(::Plots.Extrema, ::Unitful.Quantity{Float64,Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)},Unitful.Units{(Unitful.Unit{:Second}(0,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)}}}) at C:\Users\Chris\.julia\v0.6\Plots\src\axes.jl:239
 in expand_extrema!(::Plots.Axis, ::Array{Quantity{Float64, Dimensions:{𝐓}, Units:{s}},1}) at C:\Users\Chris\.julia\v0.6\Plots\src\axes.jl:262
 in expand_extrema!(::Plots.Subplot{Plots.PlotlyBackend}, ::Dict{Symbol,Any}) at C:\Users\Chris\.julia\v0.6\Plots\src\axes.jl:289...

Plotting the two parts works:

plot(sol.t,sol[:])

but the moment I put the y axis part into any kind of a vector, it fails with that same error:

plot(sol.t,[sol[:]])
plot(sol.t,Any[sol[:]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant