Reputation: 152
Say I have a 2D array. The first column contains x values and the second contains y values.
arr = [1 0.1; 2 0.2]
Outputs:
2×2 Array{Float64,2}:
1.0 0.1
2.0 0.2
If I want to plot the columns against each other I do so with
using Plots
plot(arr[:,1], arr[:,2])
Is there a cleaner way to do this?
Upvotes: 2
Views: 1101
Reputation: 42244
If you want to reference arr
only once you could do:
plot(eachcol(arr)...)
Upvotes: 1