# How to understand Makie.jl functions signatures

**URL:** <https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157>\
**Category:** General Usage\
**Tags:** plotting, makie\
**Created:** [January 11, 2021, 1:51pm UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157 "2021-01-11T13:51:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![akalinin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akalinin/32/20163_2.png) [@akalinin](https://discourse.julialang.org/u/akalinin)\
**Post date:** [January 11, 2021, 1:51pm UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/1 "2021-01-11T13:51:51Z")

</div>

I want to draw 3D mesh using Makie.jl.

I try to inspect mesh function

```julia
julia> using GLMakie

help?> mesh

  mesh(x, y, z)
  mesh(mesh_object)
  mesh(x, y, z, faces)
  mesh(xyz, faces)

```

For me it is not clear what are the types of `(x, y, z)` or what is the type of `mesh_object`. OK I try to inspect manually

```julia
julia> methods(mesh)
# 2 methods for generic function "mesh":
[1] mesh() in AbstractPlotting at C:\Users\aleck\.julia\packages\AbstractPlotting\3UpN6\src\recipes.jl:130
[2] mesh(args...; attributes...) in AbstractPlotting at C:\Users\aleck\.julia\packages\AbstractPlotting\3UpN6\src\recipes.jl:11

```

Nothing clear here too, what are the `args` and what are the `attributes`.

How to to understand in the clear way the API for the `mesh` function, what kind of data types it can accept?

---

<div class="post-metadata">

**Author:** ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Post date:** [November 20, 2021, 9:05pm UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/2 "2021-11-20T21:05:16Z")

</div>

These signatures seem very unclear indeed.

- One of the signatures for `image` [seems to be](https://makie.juliaplots.org/stable/examples/plotting_functions/image/) `image(image)`. Well, sure, the floor is made out of floor, but this doesn’t tell me what type of argument `image` expects.
- One of the signatures for `lines` is `lines(positions)`. What are `positions`? A vector of tuples? A `2xN` matrix? An `Nx2` matrix? A vector of `Pair`?
- The documentation for `series(curves)` actually [explains](https://makie.juliaplots.org/stable/examples/plotting_functions/series/) what `curves` is supposed to be, which is magnificent
- The signature of [`volume`](https://makie.juliaplots.org/stable/examples/plotting_functions/volume/) is `volume(volume_data)`. Again, the volume data is made of volume data, sure, but what’s the expected type of `volume_data`? According to the example in the docs, it’s supposed to be `Array{Float64, 3}`, but `?CairoMakie.volume` just says `volume(volume_data)`, so I have to go online to see what types this function accepts.

`methods(some_plotting_function)` isn’t helpful either:

```julia
julia> methods(CairoMakie.volume)
# 2 methods for generic function "volume":
[1] volume() in MakieCore at MakieCore/S8PkO/src/recipes.jl:170
[2] volume(args...; attributes...) in MakieCore at MakieCore/S8PkO/src/recipes.jl:30

julia> methods(Makie.image)
# 2 methods for generic function "image":
[1] image() in MakieCore at MakieCore/S8PkO/src/recipes.jl:170
[2] image(args...; attributes...) in MakieCore at MakieCore/S8PkO/src/recipes.jl:30

julia> methods(Makie.lines)
# 2 methods for generic function "lines":
[1] lines() in MakieCore at MakieCore/S8PkO/src/recipes.jl:170
[2] lines(args...; attributes...) in MakieCore at MakieCore/S8PkO/src/recipes.jl:30

```

Apparently, all of these functions accept `args...`, which is even more confusing than the documentation, because it suggests that I can pass multiple arguments. What are these arguments?

---

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [November 20, 2021, 9:10pm UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/3 "2021-11-20T21:10:41Z")

</div>

Maybe the creator and maintainers of Makie can offer more information about this decision, but AFAICT it was a conscious one, in order to have methods as general as possible, allowing several ways to plot the same thing.

All the post-processing of the arguments is done internally instead of at dispatch-time.

---

<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:** [November 21, 2021, 8:08am UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/4 "2021-11-21T08:08:34Z")

</div>

The reason why it’s not clearly documented is that there are sometimes so many conversion methods that apply to one plot object, that the set of possible inputs is very large. So we’ve concentrated on other issues that needed to be fixed, although this one is a good one, too. Ideally, the conversion traits that apply to one plot object should also be automatically included in the docstring, because those increase the set of possibilities again. That’s why you have these nondescript `image` or `volume_data` placeholders, as they can be so many different things usually.

---

<div class="post-metadata">

**Author:** ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Post date:** [December 14, 2021, 11:31am UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/5 "2021-12-14T11:31:05Z")

</div>

Is it possible to see what arguments these functions support _somewhere_?

---

<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:** [December 14, 2021, 12:03pm UTC](https://discourse.julialang.org/t/how-to-understand-makie-jl-functions-signatures/53157/6 "2021-12-14T12:03:43Z")

</div>

[https://github.com/JuliaPlots/Makie.jl/blob/master/src/conversions.jl](https://github.com/JuliaPlots/Makie.jl/blob/master/src/conversions.jl)

This is where most conversion logic is defined
