# Changing default parameters

**URL:** <https://discourse.julialang.org/t/changing-default-parameters/86148>\
**Category:** General Usage\
**Tags:** question, plots\
**Created:** [August 22, 2022, 5:15pm UTC](https://discourse.julialang.org/t/changing-default-parameters/86148 "2022-08-22T17:15:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 22, 2022, 5:15pm UTC](https://discourse.julialang.org/t/changing-default-parameters/86148/1 "2022-08-22T17:15:36Z")

</div>

How can I change the default parameters of a function?

I have this code:

```julia
using Plots

x=0:0.01:100
y1=sin.(x)

p = plot(x,y1, width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12, legend=false)

```

I want to be able to write:

```julia
using Plots
include("my_defaults.jl")

x=0:0.01:100
y1=sin.(x)

p=plot(x,y1)

```

and achieve the same result. Can I redefine the function plot to use different default parameters?

---

<div class="post-metadata">

**Author:** ![liamfdoherty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamfdoherty/32/24516_2.png) [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)\
**Post date:** [August 22, 2022, 5:19pm UTC](https://discourse.julialang.org/t/changing-default-parameters/86148/2 "2022-08-22T17:19:28Z")

</div>

You can use the `default` function available with Plots.jl:

[https://docs.juliaplots.org/latest/api/#Plots.default](https://docs.juliaplots.org/latest/api/#Plots.default)

Just put your preferred settings in this function, and it will set them as the defaults for your session:

`default(width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)`
