Custom plots

x = 1:10; y = rand(10)
maxpt = reverse(findmax(y))  # reversing so it's (x,y) rather than (y, x)
minpt = reverse(findmin(y))
plot(x, y)
scatter!([maxpt, minpt], label = "extrema")

More generally, findmax/findmin return (extremum, index). So if x didn’t conveniently go from 1-10, you would index into it with the appropriate index to make minpt/maxpt

4 Likes