Eli Tsinberg
Eli Tsinberg

Reputation: 142

Julia - plot with 2 arrays of same size

I have two arrays:

sigma = logspace(-4,4,5)

which looks like = [10^-4,10^-2,10,10^2,10^4]

and some other array that contains 5 values which were generated from norm-2 of some 5 different vectors. assume this is the second array:

Xnorm = [1,2,3,4,5]

I'm trying to plot those two arrays:

figure()
plot(Xnorm,sigma)

I would like that sigma will represent the X-axis and Xnorm the y-axis. The result right now is an empty graph. (I've tried to swap between both of them also).

Unfortunately, I did not found any good documentation for plotting with array.

Upvotes: 1

Views: 1562

Answers (1)

Chris Rackauckas
Chris Rackauckas

Reputation: 19132

You need to import the plotting library

sigma = logspace(-4,4,5)
Xnorm = [1,2,3,4,5]
# Pkg.add("Plots") # Do this only the first time to install.
using Plots
plot(Xnorm,sigma)

Upvotes: 6

Related Questions