I get an error every time I try plotting in Julia. The code I have been using to generate the histograms is as below:
using StatsBase
using Plots
a = reshape(intl,(500*100)) ;
plt1 = fit(Histogram,a,30:10:150) ;
plot(plt1,xticks=30:10:150,xlim(30,150)) ;
The error is as follows:
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class ‘RuntimeError’>
RuntimeError(‘Julia exception: MethodError: no method matching iterate(::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}})\nClosest candidates are:\n iterate(!Matched::Core.SimpleVector) at essentials.jl:568\n iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:568\n iterate(!Matched::ExponentialBackOff) at error.jl:199\n …\nStacktrace:\n [1] jlwrap_iterator(::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyiterator.jl:150\n [2] pyjlwrap_getiter(::Ptr{PyCall.PyObject_struct}) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyiterator.jl:131\n [3] macro expansion at /home/nv/.julia/packages/PyCall/a5Jd3/src/exception.jl:81 [inlined]\n [4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::PyCall.PyObject) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:44\n [5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}},Tuple{Int64,Int64}}, ::Int64, ::PyCall.PyObject) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:29\n [6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}},Tuple{Int64,Int64}}, ::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:11\n [7] #pycall#110(::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:86\n [8] (::getfield(PyCall, Symbol(“#kw##pycall”)))(::NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}, ::typeof(PyCall.pycall), ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at ./none:0\n [9] #plot#85(::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}, ::Function, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at /home/nv/.julia/packages/PyPlot/KRYZs/src/PyPlot.jl:178\n [10] (::getfield(PyPlot, Symbol(“#kw##plot”)))(::NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}, ::typeof(plot), ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at ./none:0\n [11] top-level scope at none:0\n [12] eval at ./boot.jl:328 [inlined]\n [13] repleval(::Module, ::Expr) at /home/nv/.julia/packages/Atom/mngyX/src/repl.jl:147\n [14] (::getfield(Atom, Symbol(“##168#170”)){Module})() at /home/nv/.julia/packages/Atom/mngyX/src/repl.jl:182\n [15] with_logstate(::getfield(Atom, Symbol(“##168#170”)){Module}, ::Base.CoreLogging.LogState) at ./logging.jl:395\n [16] with_logger at ./logging.jl:491 [inlined]\n [17] evalrepl(::Module, ::String) at /home/nv/.julia/packages/Atom/mngyX/src/repl.jl:173\n [18] top-level scope at /home/nv/.julia/packages/Atom/mngyX/src/repl.jl:216\n [19] eval(::Module, ::Any) at ./boot.jl:328\n [20] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:85\n [21] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:117 [inlined]\n [22] (::getfield(REPL, Symbol(“##26#27”)){REPL.REPLBackend})() at ./task.jl:259’)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/pyplot.py”, line 2811, in plot
is not None else {}), **kwargs)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/init.py”, line 1810, in inner
return func(ax, *args, **kwargs)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/axes/_axes.py”, line 1611, in plot
for line in self._get_lines(*args, **kwargs):
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/axes/_base.py”, line 393, in _grab_next_args
yield from self._plot_args(this, kwargs)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/axes/_base.py”, line 370, in _plot_args
x, y = self._xy_from_xy(x, y)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/axes/_base.py”, line 204, in _xy_from_xy
bx = self.axes.xaxis.update_units(x)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/axis.py”, line 1467, in update_units
converter = munits.registry.get_converter(data)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/units.py”, line 181, in get_converter
converter = self.get_converter(next_item)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/units.py”, line 187, in get_converter
thisx = safe_first_element(x)
File “/home/nv/.julia/conda/3/lib/python3.7/site-packages/matplotlib/cbook/init.py”, line 1637, in safe_first_element
return next(iter(obj))
Stacktrace:
[1] pyerr_check at /home/nv/.julia/packages/PyCall/a5Jd3/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/nv/.julia/packages/PyCall/a5Jd3/src/exception.jl:64 [inlined]
[3] macro expansion at /home/nv/.julia/packages/PyCall/a5Jd3/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::PyCall.PyObject) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}},Tuple{Int64,Int64}}, ::Int64, ::PyCall.PyObject) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:29
[6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}},Tuple{Int64,Int64}}, ::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:11
[7] #pycall#110(::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at /home/nv/.julia/packages/PyCall/a5Jd3/src/pyfncall.jl:86
[8] (::getfield(PyCall, Symbol(“#kw##pycall”)))(::NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}, ::typeof(PyCall.pycall), ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at ./none:0
[9] #plot#85(::Base.Iterators.Pairs{Symbol,StepRange{Int64,Int64},Tuple{Symbol},NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}}, ::Function, ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at /home/nv/.julia/packages/PyPlot/KRYZs/src/PyPlot.jl:178
[10] (::getfield(PyPlot, Symbol(“#kw##plot”)))(::NamedTuple{(:xticks,),Tuple{StepRange{Int64,Int64}}}, ::typeof(plot), ::Histogram{Int64,1,Tuple{StepRange{Int64,Int64}}}, ::Vararg{Any,N} where N) at ./none:0
[11] top-level scope at none:0