If you do `using PyPlot` then you can just use `hist` directly: using PyPlot
x = randn(10000) hist(x, 100) El lunes, 26 de octubre de 2015, 10:21:59 (UTC-6), Ferran Mazzanti escribió: > > Oh, thnks for the info... > > On Monday, October 26, 2015 at 12:25:26 PM UTC+1, Kristoffer Carlsson > wrote: >> >> Read here: https://github.com/stevengj/PyCall.jl#usage >> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fstevengj%2FPyCall.jl%23usage&sa=D&sntz=1&usg=AFQjCNH7nXL2YvYmMDRWhIqXP-0ZeHzMlQ> >> >> More specifically, this section: >> >> "The biggest diffence from Python is that object attributes/members are >> accessed with o[:attribute]rather than o.attribute, and you use get(o, >> key) rather than o[key]. (This is because Julia does not permit >> overloading the . operator yet.) See also the section on PyObject below, >> as well as the pywrap function to create anonymous modules that simulate >> . access (this is what @pyimportdoes). For example, using Biopython >> <http://biopython.org/wiki/Seq> we can do: >> >> @pyimport Bio.Seq as s >> @pyimport Bio.Alphabet as a >> my_dna = s.Seq("AGTACACTGGT", a.generic_dna) >> my_dna[:find]("ACT") >> >> whereas in Python the last step would have been my_dna.find("ACT")" >> >> On Monday, October 26, 2015 at 11:38:41 AM UTC+1, Ferran Mazzanti wrote: >>> >>> That worked, thanks :) >>> >>> But this syntax I can not understand... where can I find documentation >>> about how to do that? Just to avoid asking agains cuh kind of questions... >>> >>> Thanks again. >>> >>> On Monday, October 26, 2015 at 11:31:59 AM UTC+1, Kristoffer Carlsson >>> wrote: >>>> >>>> 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. >>>>> >>>>> >>>>>
