Torkel
January 30, 2023, 8:34pm
1
I want to scatter plto a bunch of dots, attaching a label to each. However, the label
command gives the first label to each dot. Sample code:
using Plots
xs = [1,2,3]
ys = [2,4,6]
colors = [:red :blue :green]
labels = ["datapoint 1" "datapoint 2" "datapoint 2"]
scatter(xs,ys,color=colors,label=labels)
gives
Torkel
January 30, 2023, 8:51pm
3
That example is for setting numbers at the location of each scatter point, but I rather want a normal legend with labels in one corner, with one label for each dot.
In that simpler case, just transpose the input vectors:
scatter(xs', ys', color=colors, label=labels)
Torkel
January 30, 2023, 9:01pm
5
That worked! Thanks a lot