Change last line to:
h = PyPlot.plt[:hist](x,nbins)
On Monday, October 26, 2015 at 11:28:35 AM UTC+1, Ferran Mazzanti wrote:
>
> Hi folks,
>
> using Linux Mint 17.1 here. I upgraded to julia 0.4.0 and now this simple
> code, taken from the web and tested on previous versions,
>
> using PyPlot
>
> x = randn(1000) # Values
> nbins = 50 # Number of bins
>
> fig = figure("pyplot_histogram",figsize=(6,6)) # Not strictly required
> ax = axes() # Not strictly required
> h = PyPlot.plt.hist(x,nbins) # Histogram, PyPlot.plt required to
> differentiate with conflicting hist command
>
> Produces the following output
>
> LoadError: type PyObject has no field hist
> while loading In[133], in expression starting on line 6
>
> in getindex at /home/mazzanti/.julia/v0.4/PyCall/src/PyCall.jl:240
> in pysequence_query at
> /home/mazzanti/.julia/v0.4/PyCall/src/conversions.jl:781
> [inlined code] from /home/mazzanti/.julia/v0.4/PyCall/src/conversions.jl:797
> in pytype_query at /home/mazzanti/.julia/v0.4/PyCall/src/conversions.jl:826
> in convert at /home/mazzanti/.julia/v0.4/PyCall/src/conversions.jl:846
> in pycall at /home/mazzanti/.julia/v0.4/PyCall/src/PyCall.jl:399
> in call at /home/mazzanti/.julia/v0.4/PyCall/src/PyCall.jl:407
> in close_queued_figs at /home/mazzanti/.julia/v0.4/PyPlot/src/PyPlot.jl:401
>
> Any hint on that? Am I doing something wrong? If so, can anybody help on how
> to do histograms in Julia 0.4.0?
>
> Thanks,
>
> Ferran.
>
>
>