# Add title to Makie plot and maintain previous scene settings

**URL:** <https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225>\
**Category:** General Usage\
**Created:** [July 17, 2020, 9:39am UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225 "2020-07-17T09:39:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [July 17, 2020, 9:39am UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/1 "2020-07-17T09:39:29Z")

</div>

I have:

```julia
  using Makie

  scene = Scene(resolution = (1200, 1400))
  lines!(scene, randn(10))
  # display(scene)
  display(title(scene, "Title"))

```

which changes the resolution compared to using just `display(scene)`. What is the way to preserve previous `scene` settings?

---

<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:** [September 5, 2020, 9:33pm UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/2 "2020-09-05T21:33:53Z")

</div>

```julia
axis = scene[Axis]
axis.names.title = "My Title"

```

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [September 6, 2020, 1:35am UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/3 "2020-09-06T01:35:10Z")

</div>

Thank you. It works for plots with axes. Is there a more general form, which would work in this case too?

```julia
using AbstractPlotting, GLMakie, Random

image = rand(1:4, 64, 48)
scene = Scene(resolution = (1200, 1000))
image!(scene, image, scale_plot = false, show_axis = false, interpolate = false, colormap=[:white, :blue, :green, :red])
axis = scene[Axis]
axis.names.title = "My Title"
display(scene)
.....
ERROR: LoadError: type Nothing has no field names

```

---

<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:** [September 6, 2020, 10:54am UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/4 "2020-09-06T10:54:10Z")

</div>

It seems that [MakieLayout.jl](https://jkrumbiegel.github.io/MakieLayout.jl/stable/) could help for what you need:

```julia
using MakieLayout, AbstractPlotting
using Random

outer_padding = 30
scene, layout = layoutscene(outer_padding, resolution = (1200, 1000));
ax1 = layout[1, 1] = LAxis(scene, title = "My Title")

image = rand(1:4, 64, 48);
image!(ax1, image, scale_plot = false, show_axis = false, interpolate = false, colormap=[:white, :blue, :green, :red])
tightlimits!.(ax1)
hidedecorations!.(ax1)
display(scene)

```

PS: _As a word of caution, I am a Julia beginner and it seems hard to keep track of all the packages needed to do something. In case of Makie there are several in the GLMakie, MakieLayout, AbstractPlotting, etc…_

---

<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:** [September 6, 2020, 3:53pm UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/5 "2020-09-06T15:53:39Z")

</div>

NOTE: according to [MakieLayout.jl](https://github.com/jkrumbiegel/MakieLayout.jl)’s github page, it has been absorbed by AbstractPlotting, which sounds good.

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [September 6, 2020, 8:38pm UTC](https://discourse.julialang.org/t/add-title-to-makie-plot-and-maintain-previous-scene-settings/43225/6 "2020-09-06T20:38:20Z")

</div>

Thank you. MakieLayout is indeed a more flexible way of doing it. I don’t like that it ignores `show_axis` parameter in:

```julia
image!(ax1, image, scale_plot = false, show_axis = false, interpolate = false, colormap=[:white, :blue, :green, :red])

```
