How to Insert Text into a Julia Plot
Code 1
You can use annotate!()
. The following code is for drawing a picture that marks the maximum and minimum points in Brownian motion.
using Plots
cd(@__DIR__)
data = cumsum(randn(100))
plot(data, color = :black, legend = :none)
annotate!(argmax(data), maximum(data), "max\n")
annotate!(argmin(data), minimum(data), "\nmin")
png("result")
Environment
- OS: Windows
- julia: v1.7.0