Annotate data points in a y matrix with several series

Are there a way to do [println($(a[i,j])) for i in 1:10, j in 1:3]?

a=zeros(10,3)
[println("$(a[i,:])") for i in 1:10]#works
[println("$(a[i,j])") for i in 1:10, for j in 1:3] #nope
[println("$(a[i,j])") for i in 1:10, j in 1:3] #nope

So it can be applied within annotate!() in plotting:

x_len=3 #3 points of x
series=4 # 4 series
x=rand(x_len) 
y=rand(x_len,series) #y matrix
note=rand(x_len,series)
#If I wnat to plot y matrix and mark each data point with the note correspondingly
plot(x,y)
annnotate!(x[i],y[i,j],string(note[i,j]) for i in 1:x_len, for j in 1:series)
# annnotate!(  [x[i],y[i,j],string(note[i,j]) for i in 1:x_len, for j in 1:series]   )
# annnotate!(  [  (x[i],y[i,j],string(note[i,j]) for i in 1:x_len, for j in 1:series)  ]   )

can you not do

for i in 1:x_len, j in 1:series)
    annotate!(x[i], y[i,j], string(note[i,j]))
end

?

1 Like