# Plotting functions with keyword arguments

**URL:** <https://discourse.julialang.org/t/plotting-functions-with-keyword-arguments/86270>\
**Category:** New to Julia\
**Tags:** plots\
**Created:** [August 24, 2022, 3:56pm UTC](https://discourse.julialang.org/t/plotting-functions-with-keyword-arguments/86270 "2022-08-24T15:56:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CIJ](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@CIJ](https://discourse.julialang.org/u/CIJ)\
**Post date:** [August 24, 2022, 3:56pm UTC](https://discourse.julialang.org/t/plotting-functions-with-keyword-arguments/86270/1 "2022-08-24T15:56:20Z")

</div>

I define a simple function:

my\_line(x;m=1,b=0)=m\*x+b

I plot my simple function:

plot(my\_line,-10,10,framestyle=:origin)

Great, no problem.

Now I want to change a keyword parameter in my\_line, m=-1.

How do I do this in the plot call (ie without altering the function definition)?

eg, plot(my\_line(x;m=-1),…) and plot(my\_line,m=-1,…) etc… have failed to produce the desired result.

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [August 24, 2022, 4:16pm UTC](https://discourse.julialang.org/t/plotting-functions-with-keyword-arguments/86270/2 "2022-08-24T16:16:13Z")

</div>

It should work with an anonymous function like so:  
`plot(x -> my_line(x;m=-1),…)`

---

<div class="post-metadata">

**Author:** ![CIJ](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@CIJ](https://discourse.julialang.org/u/CIJ)\
**Post date:** [August 24, 2022, 4:49pm UTC](https://discourse.julialang.org/t/plotting-functions-with-keyword-arguments/86270/3 "2022-08-24T16:49:20Z")

</div>

did the job, thanks!
