#Can't plot graph in jyupiter?

1 messages · Page 1 of 1 (latest)

outer gazelle
#

code:

import Pkg
Pkg.add("IJulia")
Pkg.add("Plots")

using Plots

#X is a range from 1 to 10
local x = 1 : 10
local y = log10(1 + (1 / x));

plot(x, y)

Error:

MethodError: no method matching +(::Int64, ::LinearAlgebra.Transpose{Float64, Vector{Float64}})
For element-wise addition, use broadcasting with dot syntax: scalar .+ array
Closest candidates are:
  +(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:591
  +(::T, !Matched::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:87
  +(::Union{Int16, Int32, Int64, Int8}, !Matched::BigInt) at gmp.jl:537
  ...

Stacktrace:
 [1] top-level scope
   @ ~/Documents/benfordslaw/Benford's Law.ipynb:9
silent pumice
#

Have you tried changing it to
log10.(1+(1/x));

outer gazelle
#

also, do you know how to make vscode find julia?

#

I had to swtich to my PC running linux

#

so i did sudo dnf install julia and now it wont work

#

it wont show as a nodebook kernel either

#

nvm it does now??

#

uh

#

ok

#

thanks!

outer gazelle
#

i get a "x is not defined" error

#

Also, I still get the same error

outer gazelle
#

(fixed)