Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Error: type Array has no field data

$
0
0

@Eldho.Ashna wrote:

Hi everyone.

I was doing the course on Flux.jl by JuliaAcademy. When I run the following code,

using Plots
plot()

contour!(0:0.01:1, 0:0.01:1, (x,y)->model([x,y]).data[1], levels=[0.5, 0.51], color = cgrad([:blue, :blue]))
contour!(0:0.01:1, 0:0.01:1, (x,y)->model([x,y]).data[2], levels=[0.5,0.51], color = cgrad([:green, :green]))
contour!(0:0.01:1, 0:0.01:1, (x,y)->model([x,y]).data[3], levels=[0.5,0.51], color = cgrad([:red, :red]))

scatter!(first.(x_apples), last.(x_apples), m=:cross, label="apples", color = :blue)
scatter!(first.(x_bananas), last.(x_bananas), m=:circle, label="bananas", color = :green)
scatter!(first.(x_grapes), last.(x_grapes), m=:square, label="grapes", color = :red)

I’m getting the following error:

type Array has no field data

Stacktrace:
 [1] getproperty(::Array{Float32,1}, ::Symbol) at ./Base.jl:20
 [2] (::var"#23#24")(::Float64, ::Float64) at ./In[46]:4
 [3] Surface(::var"#23#24", ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}) at /home/g2-test/.julia/packages/Plots/CFRKM/src/components.jl:660
 [4] macro expansion at /home/g2-test/.julia/packages/Plots/CFRKM/src/series.jl:467 [inlined]
 [5] apply_recipe(::Dict{Symbol,Any}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Function) at /home/g2-test/.julia/packages/RecipesBase/G4s6f/src/RecipesBase.jl:279
 [6] _process_userrecipes(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},var"#23#24"}) at /home/g2-test/.julia/packages/Plots/CFRKM/src/pipeline.jl:85
 [7] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},var"#23#24"}) at /home/g2-test/.julia/packages/Plots/CFRKM/src/plot.jl:178
 [8] #plot!#143(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:levels, :color, :seriestype),Tuple{Array{Float64,1},ColorGradient,Symbol}}}, ::typeof(plot!), ::Plots.Plot{Plots.GRBackend}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at /home/g2-test/.julia/packages/Plots/CFRKM/src/plot.jl:158
 [9] (::RecipesBase.var"#kw##plot!")(::NamedTuple{(:levels, :color, :seriestype),Tuple{Array{Float64,1},ColorGradient,Symbol}}, ::typeof(plot!), ::Plots.Plot{Plots.GRBackend}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at ./none:0
 [10] #plot!#142(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:levels, :color, :seriestype),Tuple{Array{Float64,1},ColorGradient,Symbol}}}, ::typeof(plot!), ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at /home/g2-test/.julia/packages/Plots/CFRKM/src/plot.jl:150
 [11] (::RecipesBase.var"#kw##plot!")(::NamedTuple{(:levels, :color, :seriestype),Tuple{Array{Float64,1},ColorGradient,Symbol}}, ::typeof(plot!), ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at ./none:0
 [12] #contour!#438(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:levels, :color),Tuple{Array{Float64,1},ColorGradient}}}, ::typeof(contour!), ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at /home/g2-test/.julia/packages/RecipesBase/G4s6f/src/RecipesBase.jl:394
 [13] (::Plots.var"#kw##contour!")(::NamedTuple{(:levels, :color),Tuple{Array{Float64,1},ColorGradient}}, ::typeof(contour!), ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at ./none:0
 [14] top-level scope at In[46]:3

I’m using Flux v0.10.1. This error is because of the version change. I think that contour! is making the error.

Can someone help me to solve this.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles