Document use of tuples in annotations attribute
The `annotations` attribute (and `annotate!` function) has supported the use of plain tuples containing arguments which are passed to `text` since v0.22.2. Document this option in the list of SubPlot attributes and in example 20. Closes (mostly) https://github.com/JuliaPlots/RecipesBase.jl/issues/72 but note that `series_annotations` does not yet support passing tuples of arguments for `Plots.text`.
This commit is contained in:
parent
91e91ac821
commit
5d935d29c5
@ -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.",
|
: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.",
|
:legendfont => "Font. Font of legend items.",
|
||||||
:legendtitlefont => "Font. Font of the legend title.",
|
: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.",
|
:annotationfontfamily => "String or Symbol. Font family of annotations.",
|
||||||
:annotationfontsize => "Integer. Font pointsize of annotations.",
|
:annotationfontsize => "Integer. Font pointsize of annotations.",
|
||||||
:annotationhalign => "Symbol. horizontal alignment of annotations, :hcenter, :left, :right or :center.",
|
:annotationhalign => "Symbol. horizontal alignment of annotations, :hcenter, :left, :right or :center.",
|
||||||
|
|||||||
@ -370,10 +370,19 @@ const _examples = PlotExample[
|
|||||||
"Annotations",
|
"Annotations",
|
||||||
"""
|
"""
|
||||||
The `annotations` keyword is used for text annotations in data-coordinates. Pass in a
|
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!(;
|
tuple `(x, y, text)`, or a vector of annotations, each of which is a tuple of `x`, `y`
|
||||||
annotation=ann)`. Series annotations are used for annotating individual data points.
|
and `text`.
|
||||||
They require only the annotation... x/y values are computed. A `PlotText` object can be
|
`text` may be a simple `String`, or a `PlotText` object, which can be
|
||||||
build with the method `text(string, attr...)`, which wraps font and color attributes.
|
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,
|
leg = false,
|
||||||
)
|
)
|
||||||
annotate!([
|
annotate!([
|
||||||
(5, y[5], Plots.text("this is #5", 16, :red, :center)),
|
(5, y[5], ("this is #5", 16, :red, :center)),
|
||||||
(
|
(
|
||||||
10,
|
10,
|
||||||
y[10],
|
y[10],
|
||||||
Plots.text("this is #10", :right, 20, "courier"),
|
("this is #10", :right, 20, "courier"),
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
scatter!(
|
scatter!(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user