Stream: helpdesk (published)

Topic: Very simple issue with plotting.


view this post on Zulip Jason Pekos (Dec 14 2021 at 02:28):

Hi! I'm very new to julia, and I can't figure out for the life of me why the following code doesn't work.

using Plots

x = 1:10;

plot(x, x.^2)

which returns

LoadError: MethodError: no method matching plot(::UnitRange{Int64}, ::Vector{Int64})

view this post on Zulip Ian Weaver (Dec 14 2021 at 03:44):

Hey Jason, welcome! Very strange, could it be that you are using an out of date version of Plots.jl? What you wrote above seems to work fine for me (on Julia v.1.7.0, Plots.jl v1.25.2).

On a side note: We don't need to add semicolons to the end of every statement in Julia. They're mostly just for hiding the output that is automatically displayed if we want

view this post on Zulip Jason Pekos (Dec 14 2021 at 04:14):

thank you!

I was using Julia v1.6.2 and Plots.jl v1.23.2 ... I tried upgrading to Plots.jl v1.25.2 and it still didn't work. I wish I had a better answer for you, just in case someone else runs into this same issue in the future, but eventually it just started working. I have no clue what I did to fix this problem :-/

Still, thanks for all your help!


Last updated: Nov 22 2024 at 04:41 UTC