This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Cannot set annotation font style without Plots dependency #72
Comments
This commit: JuliaPlots/Plots.jl@7acb5a4 was intended to fix this, allowing passing a tuple instead to annotations. I know for a fact that it used to work, but something might have changed. |
So this works struct MyType end
@recipe function f(x::MyType)
annotations := (2, 4, ( "test", :right, 20))
1:10, 1:10
end
plot(MyType()) |
Might be relevant: JuliaPlots/Plots.jl#3463 |
Thanks very much! I hadn't realised that passing tuples (edit: of arguments to When time allows I'll submit a PR to add this to the docs (specifically the attributes list here and here for each backend). I can't find this mentioned anywhere and so I think that's why I hadn't realised it could be done. Edit: I now see that this is in |
anowacki
added a commit
to anowacki/Seis.jl
that referenced
this issue
Jul 7, 2021
Pick labels are now drawn using bare tuples as `annotations` to a plot series (see JuliaPlots/Plots.jl@7acb5a4 and JuliaPlots/RecipesBase.jl#72) rather than via a hack to get the `Plots` module from `Main`.
anowacki
added a commit
to anowacki/Seis.jl
that referenced
this issue
Jul 7, 2021
Pick labels are now drawn using bare tuples as `annotations` to a plot series (see JuliaPlots/Plots.jl@7acb5a4 and JuliaPlots/RecipesBase.jl#72) rather than via a hack to get the `Plots` module from `Main`. In summary, Plots.jl now allows the `annotations` attribute to contain `(x, y, (text, text_args...))`, where `text_args...` are passed to the `Plots.text` constructor.
anowacki
added a commit
to anowacki/Seis.jl
that referenced
this issue
Jul 7, 2021
Pick labels are now drawn using bare tuples as `annotations` to a plot series (see JuliaPlots/Plots.jl@7acb5a4 and JuliaPlots/RecipesBase.jl#72) rather than via a hack to get the `Plots` module from `Main`. Specifically, Plots.jl now allows the `annotations` attribute to contain `(x, y, (text, text_args...))`, where `text_args...` are passed to the `Plots.text` constructor.
anowacki
added a commit
to anowacki/Seis.jl
that referenced
this issue
Jul 7, 2021
Pick labels are now drawn using bare tuples as `annotations` to a plot series (see JuliaPlots/Plots.jl@7acb5a4 and JuliaPlots/RecipesBase.jl#72) rather than via a hack to get the `Plots` module from `Main`. Specifically, Plots.jl now allows the `annotations` attribute to contain `(x, y, (text, text_args...))`, where `text_args...` are passed to the `Plots.text` constructor. Previously we use `series_annotations` to simultaneously plot symbols and text at those points. (Note that `series_annotations` **does not** support plain tuples and requires a call to `Plots.text` to format the series annotations.) Now we plot a separate, empty series with `annotations` set.
anowacki
added a commit
to anowacki/Plots.jl
that referenced
this issue
Jul 7, 2021
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) JuliaPlots/RecipesBase.jl#72 but note that `series_annotations` does not yet support passing tuples of arguments for `Plots.text`.
This was referenced Jul 7, 2021
anowacki
added a commit
to anowacki/PlotDocs.jl
that referenced
this issue
Jul 7, 2021
Companion to JuliaPlots/Plots.jl#3628 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 for example 20 for the InspectDR backend (not autogenerated). Closes (mostly) JuliaPlots/RecipesBase.jl#72
anowacki
added a commit
to anowacki/Plots.jl
that referenced
this issue
Jul 8, 2021
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) JuliaPlots/RecipesBase.jl#72 but note that `series_annotations` does not yet support passing tuples of arguments for `Plots.text`.
anowacki
added a commit
to anowacki/Plots.jl
that referenced
this issue
Jul 8, 2021
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) JuliaPlots/RecipesBase.jl#72 but note that `series_annotations` does not yet support passing tuples of arguments for `Plots.text`.
BeastyBlacksmith
pushed a commit
to JuliaPlots/PlotDocs.jl
that referenced
this issue
Jun 7, 2022
Companion to JuliaPlots/Plots.jl#3628 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 for example 20 for the InspectDR backend (not autogenerated). Closes (mostly) JuliaPlots/RecipesBase.jl#72
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is a long-standing issue (e.g., see here), but one I still bump up against, though I can't find a specific issue here or in Plots for it.
I would like to be able to define the format (family, size, colour, etc.) of series annotations in recipes (with
series_annotations
), but I do not want to depend on Plots, and this is currently impossible. There is currently no way to set these properties without usingPlots.text
and therebyPlots.font
. The fix for JuliaPlots/Plots.jl#555 (JuliaPlots/Plots.jl@f2e2ffa) now allows one to use recipes to set font attributes for labels, but not annotations on plots themselves. The workaround here does not work in all cases—for instance when the calling module has loadedPlots
, but not in toMain
—and is pretty brittle in any case.Though I don't much understand RecipesBase or Plots internals, for me as a user it would make sense to set attributes similar those introduced by JuliaPlots/Plots.jl@f2e2ffa, and in recipes use (for example)
:annotfontfamily
,:annotfontsize
and so on to set annotation font parameters.The text was updated successfully, but these errors were encountered: