# Plotting single points on an anonymous function

**URL:** https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126
**Category:** New to Julia
**Tags:** plotting, plots, plot
**Created:** [November 11, 2022, 3:51pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126 "2022-11-11T15:51:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![comical\_intersection](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comical_intersection/32/44306_2.png) [@comical\_intersection](https://discourse.julialang.org/u/comical_intersection)
#### Post date: [November 11, 2022, 3:51pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/1 "2022-11-11T15:51:45Z")

</div>

I have a function which depends on a single variable x and a variable l.  
I plot these functions for different integer variables of l like so:  
`plot!(fig, x->f(x, l=3))`

so in general:

`plot!(fig, x->f(x, l=i))`

However for each f(x,i), there is a specific point on the curve that I want to label depending only on x-values that i have, ideally like this (the following is pseudocode):

`plot!(fig, x->f(x, l=3), label(f(some_number), red, sploosh, 5pt))`

Is this possible or do I really need to create a separate dataframe, calculate the x- and y values and overlay the plot with a scatter based on those values?

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [November 11, 2022, 4:02pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/2 "2022-11-11T16:02:36Z")

</div>

Try:

```julia
 annotate!(x0, f(x0, l=3), text("sploosh", :red, 5))

```

---

<div class="post-metadata">

### Author: ![comical\_intersection](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comical_intersection/32/44306_2.png) [@comical\_intersection](https://discourse.julialang.org/u/comical_intersection)
#### Post date: [November 11, 2022, 4:10pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/3 "2022-11-11T16:10:53Z")

</div>

Thank you very much!

---

<div class="post-metadata">

### Author: ![comical\_intersection](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comical_intersection/32/44306_2.png) [@comical\_intersection](https://discourse.julialang.org/u/comical_intersection)
#### Post date: [November 11, 2022, 6:54pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/4 "2022-11-11T18:54:16Z")

</div>

A small follow-up question, how can I mark the actual point on the graph, rather than floating something besides it with annotate!() ? I have searched for it the past 3 hours but I can’t seem the find a function that ploints a simple single point without using convoluted ways with scatter and whatnot.  
Thanks in advance!

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [November 11, 2022, 7:58pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/5 "2022-11-11T19:58:00Z")

</div>

Try:  
`scatter!([x0], [f(x0, l=3)])`

---

<div class="post-metadata">

### Author: ![comical\_intersection](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comical_intersection/32/44306_2.png) [@comical\_intersection](https://discourse.julialang.org/u/comical_intersection)
#### Post date: [November 11, 2022, 9:55pm UTC](https://discourse.julialang.org/t/plotting-single-points-on-an-anonymous-function/90126/6 "2022-11-11T21:55:22Z")

</div>

Thank you!
