Hello,
I am looking for an efficient way to change the label from

to something like
operation1
operation2
operation3
…
but not with the manual labeling as bellow. Because for a more number of operations it seems not very efficient!
using StatsPlots;
plot!(label = ["operation1" "operation2" "operation3" ...])
Does anyone have an idea? Thanks.
A comprehension does it:
label = ["operation$j" for j = 1 : n]
thank you, I already tried that but it looks like this:

what am I doing wrong?
Apologies - I forgot that legends use 1xn arrays rather than nx1 vectors. This always trips me up. There is probably a nice one-liner that uses a comprehension to make a 1xn Matrix, but I don’t know the way. But a loop is easy.
What I do in practice is have a little function that makes sure a legend is a Matrix. It passes 1xn matrices through without change, but makes vectors into matrices. So I just call label = make_legend(lbls)
each time and don’t have to worry about whether I had a vector or matrix of labels.
label = ["operation$j" for j = (1:8)']
You need an 1xn matrix
4 Likes
Perfect! 
It works exactly the way I want, thank you.
