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

KeyError: key :letter not found #29

Closed
jamesmaino opened this issue Jun 3, 2020 · 7 comments
Closed

KeyError: key :letter not found #29

jamesmaino opened this issue Jun 3, 2020 · 7 comments

Comments

@jamesmaino
Copy link

Plots appears broken when units are used.

using Unitful, UnitfulRecipes, Plots
const a = 1u"m/s^2"
v(t) = a * t
x(t) = a/2 * t^2
t = (0:0.01:100)*u"s"
plot(x.(t), v.(t), xlabel="position", ylabel="speed")

KeyError: key :letter not found
Stacktrace:
 [1] getindex at .\dict.jl:477 [inlined]
 [2] macro expansion at C:\Users\james\.julia\packages\UnitfulRecipes\5RFXj\src\UnitfulRecipes.jl:12 [inlined]
 [3] apply_recipe(::Dict{Symbol,Any}, ::Type{Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1}}, ::Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1}) at C:\Users\james\.julia\packages\RecipesBase\G4s6f\src\RecipesBase.jl:279
 [4] _apply_type_recipe(::Dict{Symbol,Any}, ::Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1}, ::Symbol) at C:\Users\james\.julia\packages\Plots\cc8wh\src\series.jl:186
 [5] macro expansion at C:\Users\james\.julia\packages\Plots\cc8wh\src\series.jl:268 [inlined]
 [6] apply_recipe(::Dict{Symbol,Any}, ::Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1}, ::Array{Quantity{Float64,�*�^-1,Unitful.FreeUnits{(m, s^-1),�*�^-1,nothing}},1}) at C:\Users\james\.julia\packages\RecipesBase\G4s6f\src\RecipesBase.jl:279
 [7] _process_userrecipes(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1},Array{Quantity{Float64,�*^-1,Unitful.FreeUnits{(m, s^-1),�*^-1,nothing}},1}}) at C:\Users\james\.julia\packages\Plots\cc8wh\src\pipeline.jl:85
 [8] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1},Array{Quantity{Float64,�*^-1,Unitful.FreeUnits{(m, s^-1),�*^-1,nothing}},1}}) at C:\Users\james\.julia\packages\Plots\cc8wh\src\plot.jl:178
 [9] plot(::Array{Quantity{Float64,�,Unitful.FreeUnits{(m,),�,nothing}},1}, ::Vararg{Any,N} where N; kw::Base.Iterators.Pairs{Symbol,String,Tuple{Symbol,Symbol},NamedTuple{(:xlabel, :ylabel),Tuple{String,String}}}) at C:\Users\james\.julia\packages\Plots\cc8wh\src\plot.jl:57
@briochemc
Copy link
Collaborator

What version of Plots.jl are you using? I think the :letter feature was added recently. Maybe updating Plots.jl will solve this? It works for me with these versions (up-to-date or close I think)

pkg> st
Status `~/.julia/environments/v1.5/Project.toml`
  [91a5bcdd] Plots v1.3.6
  [1986cc42] Unitful v1.2.1
  [42071c24] UnitfulRecipes v0.2.4

@jamesmaino
Copy link
Author

jamesmaino commented Jun 3, 2020

Strange. Could it be a Julia v1.4 problem? Or are you using the Plots#master branch?

Here are my versions:

(@v1.4) pkg> st
Status `C:\Users\james\.julia\environments\v1.4\Project.toml`
  [91a5bcdd] Plots v0.29.9
  [1986cc42] Unitful v1.2.1
  [42071c24] UnitfulRecipes v0.2.4

@briochemc
Copy link
Collaborator

Could you try to update Plots with pkg> up? 🙂

@jamesmaino
Copy link
Author

That was the first thing I tried. Sorry, I'm still a bit new to Julia. Any other suggestions?

@briochemc
Copy link
Collaborator

briochemc commented Jun 3, 2020

Mmm... But you showed me you were using Plots v0.29.9, and the current version is Plots v1.3.6. Could you try pkg> pin Plots@v1.3.6? This should show you the incompatible unsatisfiable requirement that prevented Plots' update.

@jamesmaino
Copy link
Author

Indeed! I didn't realise other package will prevent updates like that. Thanks!

ERROR: Unsatisfiable requirements detected for package RecipesBase [3cdcf5f2]:
 RecipesBase [3cdcf5f2] log:
 ├─possible versions are: [0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 1.0.0-1.0.1] or uninstalled
 ├─restricted to versions [0.7-0.8, 1] by GeoData [9b6fcbb8], leaving only versions [0.7.0, 0.8.0, 1.0.0-1.0.1]
 │ └─GeoData [9b6fcbb8] log:
 │   ├─possible versions are: 0.1.0 or uninstalled
 │   └─GeoData [9b6fcbb8] is fixed to version 0.1.0
 ├─restricted by compatibility requirements with Plots [91a5bcdd] to versions: 1.0.0-1.0.1
 │ └─Plots [91a5bcdd] log:
 │   ├─possible versions are: [0.12.1-0.12.4, 0.13.0-0.13.1, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0, 0.17.0-0.17.4, 0.18.0, 0.19.0-0.19.3, 0.20.0-0.20.6, 0.21.0, 0.22.0-0.22.5, 0.23.0-0.23.2, 0.24.0, 0.25.0-0.25.3, 0.26.0-0.26.3, 0.27.0-0.27.1, 0.28.0-0.28.4, 0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.6] or uninstalled
 │   ├─restricted to versions [0.28-0.29, 1] by GrowthMaps [a252ced4], leaving only versions [0.28.0-0.28.4, 0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.6]
 │   │ └─GrowthMaps [a252ced4] log:
 │   │   ├─possible versions are: 0.1.0 or uninstalled
 │   │   └─GrowthMaps [a252ced4] is fixed to version 0.1.0
 │   └─restricted to versions 1.3.6 by an explicit requirement, leaving only versions 1.3.6
 └─restricted by compatibility requirements with LossFunctions [30fc2ffe] to versions: [0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0] — no versions left
   └─LossFunctions [30fc2ffe] log:
     ├─possible versions are: [0.3.0-0.3.1, 0.4.0, 0.5.0-0.5.1, 0.6.0-0.6.2] or uninstalled
     └─restricted to versions 0.5 by Dispersal [8797f018], leaving only versions 0.5.0-0.5.1
       └─Dispersal [8797f018] log:
         ├─possible versions are: 0.1.0 or uninstalled
         ├─restricted to versions 0.1 by Biosecurity [b5f6e96a], leaving only versions 0.1.0
         │ └─Biosecurity [b5f6e96a] log:
         │   ├─possible versions are: 0.1.0 or uninstalled
         │   └─Biosecurity [b5f6e96a] is fixed to version 0.1.0
         └─Dispersal [8797f018] is fixed to version 0.1.0

@jw3126
Copy link
Owner

jw3126 commented Jun 3, 2020

See also #28

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

3 participants