Reputation: 464
Fore some reason Julia refuses to plot my code
using Plots
n = 100
ϕ = range(0,stop=2*π,length=n)
x = cos.(ϕ)';
y = sin.(ϕ)';
plot(x,y)
The last time I used the same code Julia plotted:
and I already tried
I didn't change anything since the last time when Julia's plot function worked properly. so I am not sure what I am doing wrong.
Upvotes: 0
Views: 156
Reputation: 3005
FWIW, you can also plot a parametric function t ↦ [x(t), y(t)] with plot(x, y, t)
, e.g.,
plot(cos, sin, range(0,2π,length=100))
Upvotes: 1
Reputation: 4370
Try instead just
using Plots
n = 100
ϕ = range(0,stop=2*π,length=n)
x = cos.(ϕ);
y = sin.(ϕ);
plot(x,y)
The transposes are turning the results into row vectors, and Plots is trying to plot each column as a separate series.
Upvotes: 2