diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 9ea4f463..d490d8c9 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -115,7 +115,7 @@ const _arg_desc = KW( :colorbar_formatter => "Function, :scientific, :plain or :auto. A method which converts a number to a string for tick labeling.", :legendfont => "Font. Font of legend items.", :legendtitlefont => "Font. Font of the legend title.", -:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String or PlotText (created with `text(args...)`) Add one-off text annotations at the x,y coordinates.", +:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String, PlotText (created with `text(args...)`), or a tuple of arguments to `text` (e.g., `(\"Label\", 8, :red, :top)`). Add one-off text annotations at the x,y coordinates.", :annotationfontfamily => "String or Symbol. Font family of annotations.", :annotationfontsize => "Integer. Font pointsize of annotations.", :annotationhalign => "Symbol. horizontal alignment of annotations, :hcenter, :left, :right or :center.", diff --git a/src/examples.jl b/src/examples.jl index 191080bb..46742fbd 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -370,10 +370,19 @@ const _examples = PlotExample[ "Annotations", """ The `annotations` keyword is used for text annotations in data-coordinates. Pass in a - tuple (x,y,text) or a vector of annotations. `annotate!(ann)` is shorthand for `plot!(; - annotation=ann)`. Series annotations are used for annotating individual data points. - They require only the annotation... x/y values are computed. A `PlotText` object can be - build with the method `text(string, attr...)`, which wraps font and color attributes. + tuple `(x, y, text)`, or a vector of annotations, each of which is a tuple of `x`, `y` + and `text`. + `text` may be a simple `String`, or a `PlotText` object, which can be + built with the method `text(string, attrs...)`. + This wraps font and color attributes and allows you to set text styling. + `text` may also be a tuple `(string, attrs...)` of arguments which are passed + to `Plots.text`. + + `annotate!(ann)` is shorthand for `plot!(; annotation=ann)`. + + Series annotations are used for annotating individual data points. + They require only the annotation; x/y values are computed. Series annotations + require either plain `String`s or `PlotText` objects. """, [ :( @@ -385,11 +394,11 @@ const _examples = PlotExample[ leg = false, ) annotate!([ - (5, y[5], Plots.text("this is #5", 16, :red, :center)), + (5, y[5], ("this is #5", 16, :red, :center)), ( 10, y[10], - Plots.text("this is #10", :right, 20, "courier"), + ("this is #10", :right, 20, "courier"), ), ]) scatter!(