# RecipesBase: Text in plot recipe?

**URL:** <https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092>\
**Category:** General Usage\
**Tags:** plots, recipe\
**Created:** [October 20, 2019, 2:08am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092 "2019-10-20T02:08:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [October 20, 2019, 2:08am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/1 "2019-10-20T02:08:22Z")

</div>

Is there a way to add text to a plot recipe?

I’ve tried `@annotate` and a variety of things without success. The docs don’t mention it - that I can find anyways : [Recipes · Plots](http://docs.juliaplots.org/latest/recipes/)

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 20, 2019, 2:59am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/2 "2019-10-20T02:59:15Z")

</div>

You can assign to the keyword arguments, such as `hover` etc. like you would any other keyword argument.

See for example here  
[https://github.com/JuliaControl/ControlSystems.jl/blob/2faa4b9158ce2e055f09fa834ffca1940c8c897b/src/pid\_design.jl#L144](https://github.com/JuliaControl/ControlSystems.jl/blob/2faa4b9158ce2e055f09fa834ffca1940c8c897b/src/pid_design.jl#L144)

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [October 20, 2019, 9:51am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/3 "2019-10-20T09:51:01Z")

</div>

I’m still having no luck here’s a reproducible example

```nohighlight
struct toy 
    x
    y
end

@recipe function toyplot(X::toy)
    seriestype := :scatter
    title := "toy"
    @series begin
        y := (X.x, X.y)
        annotation := (1, -1, "Look up!") 
    end
end

plot( toy( [2,3,4,5],[1,2,3,4] ) )

```

I keep getting this error depending on the command I try(Including hove). I’ve tried symbols, etc, no luck.

```julia
No user recipe defined for String

```

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 20, 2019, 9:56am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/4 "2019-10-20T09:56:19Z")

</div>

Try this

```julia
@recipe function toyplot(X::toy)
    seriestype := :scatter
    title := "toy"
    @series begin
        annotation := (1, -1, "Look up!")
        X.x, X.y
    end
end

```

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [October 20, 2019, 9:57am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/5 "2019-10-20T09:57:55Z")

</div>

I have no idea how you figured that out, but I appreciate it. I had to change it a little so the text displayed on the plot but it works

```nohighlight
@recipe function toyplot(X::toy)
    seriestype := :scatter
    title := "toy"
    @series begin
        annotation := (3, 4, "Look up!")
        X.x, X.y
    end
end

```

Thank you!

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 20, 2019, 10:14am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092/6 "2019-10-20T10:14:28Z")

</div>

You typically return the stuff to be plotted, i.e., place `x` and `y` last in the `@series`
