# Makie "attributes" for figure, axis, and plot

**URL:** <https://discourse.julialang.org/t/makie-attributes-for-figure-axis-and-plot/82697>\
**Category:** New to Julia\
**Created:** [June 13, 2022, 6:03pm UTC](https://discourse.julialang.org/t/makie-attributes-for-figure-axis-and-plot/82697 "2022-06-13T18:03:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjmat](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@mjmat](https://discourse.julialang.org/u/mjmat)\
**Post date:** [June 13, 2022, 6:03pm UTC](https://discourse.julialang.org/t/makie-attributes-for-figure-axis-and-plot/82697/1 "2022-06-13T18:03:53Z")

</div>

I am confused by what exactly are “attributes” in Makie and how to figure out which ones exist and can be modified.

for plot objects, this seems relatively straightforward (especially coming from a Matlab background). There is a `color` attribute, and  
I can change it when calling the function with a keyword argument, or after the fact with `plt.thenameoftheattribute`:

```nohighlight
using CairoMakie
fig, ax, plt = lines([1, 2, 3], [10, 11, 12], color=:red)
display(fig)
# The plot is red
plt.color = :blue
display(fig)
# The plot is now blue

```

I can even get a list of all attributes by typing `plt.attributes`, and they are shown by typing `help(lines)`. Not if I type `?lines`, but that’s a minor complaint.

Now to the puzzling stuff…  
The axis and the figure also have attributes, at least that’s what [this page](https://juliadatascience.io/datavisMakie_attributes) says. It also says the axis attributes are listed by typing `help(Axis)`, but that doesn’t work.  
I understand from that page that the axis has a title property (attribute?), and I can indeed add a title with:

```nohighlight
ax.title = "My title"

```

And the Julia REPL is nice, if I type `ax. (+TAB)` it proposes a long list of attributes.  
But then why does `ax.attributes` fail?  
Even more puzzling, the figure “attributes” (are they really attributes?) can be changed when calling `Figure()`, e.g. with `fig = Figure(resolution = 600)`. But I can’t seem to be able to access them afterwards.  
Things like `fig.resolution` fail, and `fig. (+TAB)` in the REPL, I see there is an “attributes”, but `fig.attributes` gives nothing. How can I access figure “attributes” (or “properties”) such as `resolution` after creating a figure?

I think I am missing some basic understanding of attributes in Makie. I realize it should be possible to get the plots I want (or more or less) by picking relevant parts from the examples at [https://makie.juliaplots.org](https://makie.juliaplots.org) and from some instructions found at [Data Visualization with Makie.jl - Julia Data Science](https://juliadatascience.io/DataVisualizationMakie), but I would feel more comfortable if I understand how the whole “attributes” thing works.  
Thanks for any pointers!

---

<div class="post-metadata">

**Author:** ![filchristou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/filchristou/32/26760_2.png) [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Post date:** [June 14, 2022, 10:36am UTC](https://discourse.julialang.org/t/makie-attributes-for-figure-axis-and-plot/82697/2 "2022-06-14T10:36:06Z")

</div>

(just an end-user reply)

> [@mjmat](#):
>
> typing `help(Axis)`, but that doesn’t work.

I guess what the authors suggest is to just write into the [REPL](https://docs.julialang.org/en/v1/stdlib/REPL/#Help-mode) `? Axis`

When you create a figure essentially you instantiate a [`Scene`](https://makie.juliaplots.org/v0.15.2/documentation/scenes/) and the `resolution` is then an attribute inside the `Scene` struct. You can access it with `fig.scene.camera.resolution`, but I don’t _think_ that you can change it and simply expect it to automatically update.  
It never occurred to me to have to manually change the scene attributes after initialization and still I never got to use the `Figure.attributes`.  
Most of the user functionality regarding `attributes` in Makie is interacting with the `ax` and `plt`.  
For `Axis` there are also several functions defined to do this like [for example](https://makie.juliaplots.org/v0.15/examples/layoutables/axis/#setting_axis_limits_and_reversing_axes).

Have a look also [here](https://discourse.julialang.org/t/no-docs-for-figure-attributes-in-makie/66683) for more info in `Figure.attributes`.

But for more specifics, it all comes down to what exactly you wish to do.

---

<div class="post-metadata">

**Author:** ![mjmat](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@mjmat](https://discourse.julialang.org/u/mjmat)\
**Post date:** [June 15, 2022, 2:00am UTC](https://discourse.julialang.org/t/makie-attributes-for-figure-axis-and-plot/82697/3 "2022-06-15T02:00:37Z")

</div>

Thank you. `? Axis` does provide a lot of info - now I am just confused why `help(Axis)` is not the same, but that’s another story…  
The scene concept was one that I missed, it explains partly why I didn’t find what I was expecting to find in figure, they are in figure.scene.  
I had seen the [thread](https://discourse.julialang.org/t/no-docs-for-figure-attributes-in-makie/66683) that you reference, but unfortunately most links in it are dead, except for the [issue](https://github.com/JuliaPlots/Makie.jl/issues/1241) which is still open.

On a side note, and in case this helps others exploring for attributes, typing `<TAB>` in the REPL to get suggestions does help, but there is a strange bug (feature?) in the REPL that requires to type `<TAB>` twice to see suggestions. So e.g. if you created a figure called fig, and then type `fig. <TAB>`, you see nothing. But if you type a second `<TAB>`, you see the suggestions and you can learn about attributes in fig. This partly explains why my attributes exploration was painful (I guess sometimes I was frustrated and was typing `<TAB>` repeatedly, so I was seeing suggestions, but at other times when I was not frustrated enough I didn’t see the suggestions).
