# Changing axis properties after plotting

**URL:** <https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461>\
**Category:** General Usage\
**Tags:** plotting, makie\
**Created:** [February 20, 2024, 3:59pm UTC](https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461 "2024-02-20T15:59:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [February 20, 2024, 3:59pm UTC](https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461/1 "2024-02-20T15:59:07Z")

</div>

I’m wondering if there is a way to change the axis properties after plotting. For example,

```julia
using CairoMakie

fig = Figure()
fig[1,1] = Axis(fig)
xs = range(0, 2π, 100)
lines!(xs, sin.(xs))
# Want something like the following:
# xticks!(fig, MultiplesTicks(5,π,"π"))
display(fig)

```

I have a function `plot_data()` that plots data and returns the plotted `Figure`. The figure has several `Axis`’s, and different axes have different axes properties. I could pass multiple sets keyword arguments to `plot_data()` to control the behaviors of the individual axes, but it would make the argument list of `plot_data()` too long. If we can access the axes of the figure returned from `plot_data()` and change their properties, I won’t need to pass a bulky list of `Axis` keyword arguments to `plot_data()`.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 20, 2024, 4:14pm UTC](https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461/2 "2024-02-20T16:14:20Z")

</div>

```julia
f = Figure()
for i in 1:3, j in 1:3
    Axis(f[i, j], title = "$i, $j")
end

# pretend you get f here and want to change Axes you can't directly get as variables

ax = f.content[3]
ax.subtitle = "f.content[3]"

ax2 = content(f.layout[2, 1])
ax2.subtitle = "content(f.layout[2, 1])"

f

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/4/a452a632b86bcfd6cee61c1053e3fef53e50a4e6.png)

---

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [February 20, 2024, 6:36pm UTC](https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461/3 "2024-02-20T18:36:31Z")

</div>

Thanks! Following your example, here is the version of my example achieving what I want:

```julia
using CairoMakie

fig = Figure()
fig[1,1] = Axis(fig)
xs = range(0, 2π, 100)
lines!(xs, sin.(xs))
ax = content(fig.layout[1,1])
ax.xticks = MultiplesTicks(5,π,"π")

display(fig)

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 20, 2024, 9:19pm UTC](https://discourse.julialang.org/t/changing-axis-properties-after-plotting/110461/4 "2024-02-20T21:19:02Z")

</div>

Ah you can also do `f[1, 1]` that’s the same as `f.layout[1, 1]`
