Error in ploting

Please see: PSA: make it easier to help you

2 Likes

Screenshot 2020-08-18 at 15.23.47

Plots

using Pkg
Pkg.add("Plots")
using Plots

x = -6:0.2:9 
f(x) = x^3
y = f.(x)

gr()

plot(x,y, label="line")






This is the error

type or paste code hMethodError: no method matching get_color_palette(::Symbol, ::RGBA{Float64}, ::Int64)
Closest candidates are:
  get_color_palette(::Any, ::Any) at C:\Users\Nithin\.julia\packages\PlotUtils\nCtbM\src\colorschemes.jl:328
  get_color_palette(!Matched::ColorGradient, ::Any) at C:\Users\Nithin\.julia\packages\PlotUtils\nCtbM\src\colorschemes.jl:329

Stacktrace:
 [1] _update_subplot_colors(::Plots.Subplot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\WwFyB\src\args.jl:1436
 [2] _update_subplot_args(::Plots.Plot{Plots.GRBackend}, ::Plots.Subplot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Int64, ::Bool) at C:\Users\Nithin\.julia\packages\Plots\WwFyB\src\args.jl:1523
 [3] _subplot_setup(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at C:\Users\Nithin\.julia\packages\Plots\WwFyB\src\pipeline.jl:297
 [4] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Int64,1},Array{Int64,1}}) at C:\Users\Nithin\.julia\packages\Plots\WwFyB\src\plot.jl:206
 [5] plot(::Array{Int64,1}, ::Vararg{Array{Int64,1},N} where N; kw::Base.Iterators.Pairs{Symbol,String,Tuple{Symbol},NamedTuple{(:label,),Tuple{String}}}) at C:\Users\Nithin\.julia\packages\Plots\WwFyB\src\plot.jl:57
 [6] top-level scope at In[25]:1
 [7] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091ere

What’s the output of versioninfo() and Pkg.status()?

2 Likes

I tried your code under Julia 1.5.0 (got that from your screenshot) but it works.

If you really only did Pkg.add("Plots"), you should have obtained the correct versions. To me the error looks like some API incompatibilities, but not sure how you got into that state. I assume you have not pinned or manually installed other versions of Plots dependencies :wink:

…let’s wait for your Pkg.status().

[c52e3926] Atom v0.12.19
  [336ed68f] CSV v0.7.7
  [a93c6f00] DataFrames v0.21.6
  [9d24351c] Dolo v0.4.0
  [4d6a76a9] Econometrics v0.2.7
  [9d5cd8c9] FixedEffectModels v0.10.9
  [4d2f22df] GARCH v0.3.1
  [38e38edf] GLM v1.3.10
  [7073ff75] IJulia v1.21.2
  [e5e0dc1b] Juno v0.8.3
  [f0f68f2c] PlotlyJS v0.13.1
  [91a5bcdd] Plots v0.27.1
  [fcd29c91] QuantEcon v0.16.2
  [d519eb52] RegressionTables v0.4.0
  [a110ec8f] Temporal v0.7.0
  [9e3dc215] TimeSeries v0.18.0
  [fdbf4ff8] XLSX v0.7.3
  [8bb1440f] DelimitedFiles

You have a very old Plots version (0.27.1), the latest version is 1.6.0. The problem is that the dependencies do not play well together.

Just do a Pkg.update("Plots") and it should be fixed.

2 Likes

It still doesnt help

You make it really hard to help you.

What do you mean with “it doesn’t help”? Same error? What’s the output of Pkg.update("Plots")? Did the update work? What does Pkg.status() print now?

1 Like

yes update did work… but plot doesn’t appear… the plots version 0.29.9

The update obviously failed to update Plots.jl to the latest version, instead it updated it to 0.29.9 which is still old and having problems with the dependencies.

What is you Pkg.status() output now? Some package is probably preventing Plots.jl to be updated to the latest version.

This is the status. Thanks

I recreated your environment and called explicitly ]add Plots@1.6.0, this is what I get:

(error_in_plotting) pkg> add Plots@1.6.0
  Resolving package versions...
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.2] or uninstalled
 ├─restricted by compatibility requirements with TimeSeries [9e3dc215] to versions: [0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 1.0.0-1.0.2]
 │ └─TimeSeries [9e3dc215] log:
 │   ├─possible versions are: [0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.0-0.16.1, 0.17.0, 0.18.0, 0.19.0-0.19.1] or uninstalled
 │   └─restricted to versions * by error_in_plotting [b33bbcc9], leaving only versions [0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.0-0.16.1, 0.17.0, 0.18.0, 0.19.0-0.19.1]
 │     └─error_in_plotting [b33bbcc9] log:
 │       ├─possible versions are: 0.1.0 or uninstalled
 │       └─error_in_plotting [b33bbcc9] is fixed to version 0.1.0
 ├─restricted by compatibility requirements with Temporal [a110ec8f] to versions: [0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0]
 │ └─Temporal [a110ec8f] log:
 │   ├─possible versions are: [0.5.0-0.5.7, 0.6.0-0.6.1, 0.7.0] or uninstalled
 │   └─restricted to versions * by error_in_plotting [b33bbcc9], leaving only versions [0.5.0-0.5.7, 0.6.0-0.6.1, 0.7.0]
 │     └─error_in_plotting [b33bbcc9] log: see above
 └─restricted by compatibility requirements with Plots [91a5bcdd] to versions: 1.0.0-1.0.2 — no versions left
   └─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.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0] or uninstalled
     ├─restricted to versions * by error_in_plotting [b33bbcc9], leaving only versions [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.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0]
     │ └─error_in_plotting [b33bbcc9] log: see above
     └─restricted to versions 1.6.0 by an explicit requirement, leaving only versions 1.6.0

TimeSeries and Temporal are preventing Plots.jl to be updated.

You can remove them with Pkg.rm("TimeSeries") and Pkg.rm("Temporal").

Afterwards Pkg.update("Plots") should update it to 1.6.0.

Are you relying on those two packages?

I dont use them at present as I am still using R for Timeseries. but What if i want to use it in a later period when I fully learn Julia?

TimeSeries.jl seems to work when you add it after upgrading Plots.jl. It’s Temporal.jl which is causing the actual dependency problem.

You can inspect the Project.toml of a Julia package to see the dependencies. In case of Temporal.jl you can see that it only supports RecipeBase v0.7 https://github.com/dysonance/Temporal.jl/blob/8ee2dd7e1a8cb75b824344017c7ca87e48d310c7/Project.toml#L20 whereas Plots.jl is requiring RecipesBase v1 as seen here https://github.com/JuliaPlots/Plots.jl/blob/d6bebe1ce2d16ed7325e4d8bbd907802a32a8f0f/Project.toml#L47

What if i want to use it in a later period when I fully learn Julia?

Just open an issue at the package which prevents the updates and ask for support.

Alternatively, feel free to do it yourself and open a pull request on the package’s repository :wink: The authors will thank you.

I know I am troubling you. But I have no clues how to fix this.
This is the error when i run the command
plot(x,y, label=“line”)

could not load library "libGR.dll"
The specified module could not be found. 

Stacktrace:
 [1] setcharheight(::Float64) at C:\Users\Nithin\.julia\packages\GR\8mv9N\src\GR.jl:1395
 [2] gr_set_font(::Plots.Font, ::Plots.Subplot{Plots.GRBackend}; halign::Symbol, valign::Symbol, color::RGB{FixedPointNumbers.Normed{UInt8,8}}, rotation::Int64) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\backends\gr.jl:386
 [3] gr_set_xticks_font(::Plots.Subplot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\backends\gr.jl:688
 [4] _update_min_padding!(::Plots.Subplot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\backends\gr.jl:900
 [5] iterate at .\generator.jl:47 [inlined]
 [6] _collect(::Array{AbstractLayout,2}, ::Base.Generator{Array{AbstractLayout,2},typeof(Plots._update_min_padding!)}, ::Base.EltypeUnknown, ::Base.HasShape{2}) at .\array.jl:699
 [7] collect_similar(::Array{AbstractLayout,2}, ::Base.Generator{Array{AbstractLayout,2},typeof(Plots._update_min_padding!)}) at .\array.jl:628
 [8] map(::Function, ::Array{AbstractLayout,2}) at .\abstractarray.jl:2162
 [9] _update_min_padding!(::Plots.GridLayout) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\layouts.jl:310
 [10] prepare_output(::Plots.Plot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\plot.jl:184
 [11] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\output.jl:214
 [12] sprint(::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any,N} where N; context::Nothing, sizehint::Int64) at .\strings\io.jl:105
 [13] sprint at .\strings\io.jl:101 [inlined]
 [14] _ijulia_display_dict(::Plots.Plot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\ijulia.jl:53
 [15] display_dict(::Plots.Plot{Plots.GRBackend}) at C:\Users\Nithin\.julia\packages\Plots\6RLiv\src\init.jl:73
 [16] #invokelatest#1 at .\essentials.jl:710 [inlined]
 [17] invokelatest at .\essentials.jl:709 [inlined]
 [18] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\Nithin\.julia\packages\IJulia\tOM8L\src\execute_request.jl:112
 [19] #invokelatest#1 at .\essentials.jl:710 [inlined]
 [20] invokelatest at .\essentials.jl:709 [inlined]
 [21] eventloop(::ZMQ.Socket) at C:\Users\Nithin\.julia\packages\IJulia\tOM8L\src\eventloop.jl:8
 [22] (::IJulia.var"#15#18")() at .\task.jl:356

In :

No worries, you are not troubling me, just provide all necessary information so that everybody out there can understand your situation :wink:

This means that you don’t have GR installed, which is the back-end you have chosen to plot. Try Pkg.add("GR"). You can also choose different back-ends, like plotly() or plotlyjs() since I see that you have that installed, or pyplot() (after Pkg.add("PyPlot")).

I have no experience with Julia on Windows, but as far as I know, GR should work fine…

There is no way Plot is working. so what would be the command to plot fir i use plotly?