# How to make this plot in Julia?

**URL:** <https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065>\
**Category:** Visualization\
**Tags:** gadfly, plots, statsplots, algebraofgraphics, vegalite\
**Created:** [January 23, 2022, 1:10pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065 "2022-01-23T13:10:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 23, 2022, 1:10pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/1 "2022-01-23T13:10:07Z")

</div>

How do I make something similar to the following plot in Julia?

```julia
using RCall, DataFrames, Random
Random.seed!(123)
d = DataFrame(name = repeat(["A","B","C","D","E","F"], inner=4), 
      time=repeat([0,1,3,6], outer=6), value = rand(24));
@rput d
R"""
library(ggplot2)
library(ggrepel)
ggplot(d, aes(x=time,y=value, color=name)) + geom_point() + geom_line() + 
geom_text_repel(aes(label=name)) + ggtitle("Time evolution")
"""

```

 ![billede](https://global.discourse-cdn.com/julialang/original/3X/1/e/1e4ca8a66f8527ffd860c9fb7b91ec16de61585d.png)

The features I struggle to reproduce in Plots.jl are:

- Grouping points in a scatter plot (by name) and connecting them by a line
- Positioning the labels close to the points without overlapping

Even without `ggrepel` I can get the following in ggplot2, which is ok:

```julia
R"""
library(ggplot2)
ggplot(d, aes(x=time,y=value, color=name)) + geom_point() + geom_line() + 
geom_text(aes(label=name), nudge_y=.03) + ggtitle("No repel")
"""

```

 ![billede](https://global.discourse-cdn.com/julialang/original/3X/7/5/75c7fb4a5c4333a8d79ae21a37443b200ee098ca.png)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [January 23, 2022, 1:28pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/2 "2022-01-23T13:28:11Z")

</div>

Take a look at the documentation of

[https://github.com/JuliaPlots/AlgebraOfGraphics.jl](https://github.com/JuliaPlots/AlgebraOfGraphics.jl)

or

[https://github.com/GiovineItalia/Gadfly.jl](https://github.com/GiovineItalia/Gadfly.jl)

The latter should be very familiar if you are coming from R.

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 23, 2022, 2:12pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/3 "2022-01-23T14:12:52Z")

</div>

Thanks @juliohm I was under the impression that Gadfly was stalled, but that appears to be a misunderstanding.

It actually does ok:

## Gadfly

 ![billede](https://global.discourse-cdn.com/julialang/original/3X/4/4/449f31d64cf5a78c99c3696c440fbbe493d4119e.png)

With proper name-spacing and extra packages it also works from Weave:

```julia
using Gadfly, Cairo, Fontconfig
plot(d, x=:time, y=:value, color=:name, label=:name, 
  Gadfly.Geom.point(), Gadfly.Geom.line(), Gadfly.Geom.label())

```

Thanks for making me re-visit that.

## AlgebraOfGraphics

I’m not able to find a way to add text-labels on the plot in AlgebraOfGraphics.

This is as close as I can get:

```julia
using AlgebraOfGraphics, GLMakie
plt = data(d) * (visual(Scatter) + visual(Lines) ) * 
      mapping(:time, :value, color = :name);
AlgebraOfGraphics.draw(plt)

```

 ![billede](https://global.discourse-cdn.com/julialang/original/3X/8/6/8627e2166a0fb1503527d2c6efc1d3f36743e8e7.png)

Also, I’m not able to get the AOG plot to work from Weave.

## VegaLite

In VegaLite, I can plot points or lines or text-labels, but I can not figure out how to combine them:

```julia
using VegaLite
d |> @vlplot(:line, x = :time, y= :value, color = :name)

```

 ![billede](https://global.discourse-cdn.com/julialang/original/3X/4/5/457a4497a3f83dbb0ed3bc06a8d335221a5a8129.png)

---

<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:** [January 23, 2022, 5:30pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/4 "2022-01-23T17:30:12Z")

</div>

It is possible with Plots.jl’s `StatsPlots`, but it should be easier:

```julia
using DataFrames, Random, StatsPlots
theme(:ggplot2)
default(dpi=600)

Random.seed!(123)
df = DataFrame(name = repeat(["A","B","C","D","E","F"], inner=4), 
      time=repeat([0,1,3,6], outer=6), value = rand(24))
#
dx, dy = extrema.((df.time, df.value))
dx, dy = 0.025 .* (dx[2] - dx[1], dy[2] - dy[1])
nam0 = first.(keys(groupby(df, :name)))
cdic = Dict(nam0 .=> palette(:default)[1:length(nam0)])
col0 = [cdic[x] for x in df.name]

@df df plot(:time, :value, marker=:circle, ms=3, group=:name, legend=:outertopright, legendtitle="name")
for (x,y,nm,c) in zip(df.time, df.value, df.name, col0)
    annotate!(x + rand((-dx,dx)), y + rand((-dy,dy)), (nm, 7, c))
end
Plots.current()

```

 ![StatsPlots_grouped_line_scatter_plot](https://global.discourse-cdn.com/julialang/original/3X/7/9/79fa6f9097e54979cf251a1e1cf5ede2ec1eee47.png)

---

<div class="post-metadata">

**Author:** ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Post date:** [January 23, 2022, 7:49pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/5 "2022-01-23T19:49:25Z")

</div>

There’s definitely a way to do this in both VegaLite and AoG (including the text), though I don’t think either make it easy to do the randomized dodge you want (you’d have to define a new column that has random offsets).

In AoG you can use the Text plot type ([example here](http://juliaplots.org/AlgebraOfGraphics.jl/stable/gallery/gallery/scales/prescaled_data/#Pre-scaled-data)) and combine it with the above figure using the `+` operator. Note that any Makie plot types documented [here](https://makie.juliaplots.org/stable/examples/plotting_functions/) each have a corresponding CamelCase name that can be passed to `visual`.

In vega lite I think you would need to use an empty @vlplot() first, e.g. `@vlplot() + @vlplot(line fields) + @vlplot(text-label filed)`, but it’s been a little while since I used it.

That said, if Gadfly meets your needs, maybe you don’t need to look further. There are definitely trade-offs between them.

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 24, 2022, 8:54am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/6 "2022-01-24T08:54:29Z")

</div>

Thanks a lot @rafael.guerra ! That is impressively close to he ggplot version.

I had given up on StatsPlots because of the large compilation times, but that has really improved tremendously now, so I’ll definitely revisit that.

It would be great to have a simple way to do label colouring, and the non-overlapping label-placement as {ggrepel}, but I’ll probably come back to your solution for inspiration next time I need this.

It’s great that we have so many options in the Julia plotting eco-system, but it is a challenge to keep updated. Any thoughts on which (if any) is going to be the “ggplot for Julia”?

---

<div class="post-metadata">

**Author:** ![alusiani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alusiani/32/16415_2.png) [@alusiani](https://discourse.julialang.org/u/alusiani)\
**Post date:** [January 24, 2022, 9:05am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/7 "2022-01-24T09:05:35Z")

</div>

Here is another example using StatsPlots and series\_annotations.

```julia
using DataFrames
using CSV
## using Plots
using StatsPlots
using LaTeXStrings

```

```julia
Plots.default(size=(600,300))
Plots.pyplot()
## Plots.GRBackend()

```

```julia
date_min = 1995
date_max = 2055

```

```julia
##
## UL 90% CL B(tau -> mu gamma)
##
## 2e-9 0 0 "SuperB 75ab-1" 2025 guest
##

data = """
val uncp uncm event year type
4.4e-8 0 0 "BaBar 2010" 2010 pub
4.5e-8 0 0 "Belle 2008" 2008 pub
1e-9 0 0 "BelleII" 2025 est
5e-9 0 0 "SCT/STCF" 2030 guest
1e-9 0 0 "CEPC (Z)" 2035 guest
2e-9 0 0 "FCC-ee (Z)" 2040 est
"""

df = DataFrame(CSV.File(IOBuffer(data), delim=' ', ignorerepeated=true))
df = dropmissing(df, disallowmissing=true)

type_to_color = Dict("pub" => :green, "est" => :red, "guest" => :orange)
df.color = [type_to_color[type] for type in df.type]

```

```julia
@df df Plots.plot(
  :year,
  :val,
  series_annotations = text.(:event, :left, :bottom, rotation=45, 9),
  title=L"${\cal B}(\tau\rightarrow \mu\gamma)$",
  ## xlabel="year",
  ylabel="90% CL UL",
  xlims=(date_min, date_max),
  ylims=(2e-10, 1e-6),
  xrotation=30,
  color = :color,
  msw = 0,
  legend = false,
  seriestype=:scatter,
  yscale=:log10,
  markersize = 7,
  framestyle = (:box, :grid)
)

```

![test-julia-plot-labels_4_0](https://global.discourse-cdn.com/julialang/original/3X/2/3/233b655d71a0b633e50f630f0b95d3f1ff93c5b9.png)

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 24, 2022, 9:30am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/8 "2022-01-24T09:30:54Z")

</div>

Thanks @haberdashPI . I need a bit more help.

With VegaLite I can get the lines and points, but not the text labels. This is what I try:

```julia
using VegaLite
d |> @vlplot() + @vlplot(:line, x = :time, y= :value, color = :name) + @vlplot(:point, x = :time, y= :value, color = :name) + @vlplot(:text, x = :time, y= :value, color = :name) 

```

In AOG, this gives me an error:

```julia
using AlgebraOfGraphics, GLMakie
plt = data(d) * (visual(Scatter) + visual(Lines) + visual(Annotations)) * mapping(:time, :value, color = :name, label= :name);
AlgebraOfGraphics.draw(plt)

```

---

<div class="post-metadata">

**Author:** ![fabgrei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabgrei/32/4214_2.png) [@fabgrei](https://discourse.julialang.org/u/fabgrei)\
**Post date:** [January 24, 2022, 1:12pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/9 "2022-01-24T13:12:32Z")

</div>

Here’s the solution for AoG

```julia
let
	scatterlines = (visual(Scatter) + visual(Lines)) * mapping(:time, :value, color = :name)
	annotations = visual(Annotations) * mapping( :name => verbatim, position=(:time, :value) => Point, color = :name)

	plt = data(d) * (scatterlines + annotations)
		
	draw(plt)
end

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/b/0b087d284760e05abfd9ad58f83efc0e7d78a83e.png)

It’s a bit hidden in the docs: [http://juliaplots.org/AlgebraOfGraphics.jl/stable/gallery/gallery/scales/prescaled\_data/#Pre-scaled-data](http://juliaplots.org/AlgebraOfGraphics.jl/stable/gallery/gallery/scales/prescaled_data/#Pre-scaled-data)

This PR [add multiargument method to annotations by piever · Pull Request #1193 · MakieOrg/Makie.jl · GitHub](https://github.com/JuliaPlots/Makie.jl/pull/1193) will allow the code to be more like what you attempted.

---

<div class="post-metadata">

**Author:** ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Post date:** [January 24, 2022, 3:33pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/10 "2022-01-24T15:33:11Z")

</div>

For vegalite you haven’t said what to set the string of text to: I think you need `@vlplot(:text, x = :time, y = :value, color = :name, text = :name)`

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 24, 2022, 3:41pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/11 "2022-01-24T15:41:52Z")

</div>

Thanks @haberdashPI . This does show the lables, but right on top of the points.

Removing the points helps a bit:

```julia
using VegaLite
d |> @vlplot() + @vlplot(:line, x = :time, y= :value, color = :name) + @vlplot(:text, x = :time, y = :value, color = :name, text = :name)

```

![billede](https://global.discourse-cdn.com/julialang/original/3X/b/a/ba7186666a2f458682152ae0f085bf30c88272df.png)

---

<div class="post-metadata">

**Author:** ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Post date:** [January 24, 2022, 4:00pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/12 "2022-01-24T16:00:24Z")

</div>

You can use the [position offset channels](https://vega.github.io/vega-lite/docs/encoding.html#positon-offset) to do this, I believe.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [January 25, 2022, 10:56am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/13 "2022-01-25T10:56:00Z")

</div>

Here’s one with AlgebraOfGraphics and random label offsets:

```julia
Random.seed!(123)
d = DataFrame(name=repeat(["A","B","C","D","E","F"], inner=4), 
              time=repeat([0,1,3,6], outer=6),
              value=rand(24));

# Computed columns
d.point = Point.(d.time, d.value)
@. d.offset = map(x->15x,sincos(2π*rand())) # Too clever but interesting?

# Layers
scatter_lines = (visual(Scatter) + visual(Lines)) *
                mapping(:time, :value)
                
labels = visual(Text, align=(:center, :center)) *
         mapping(:name => verbatim,
                 position=:point,
                 offset=:offset => verbatim)

draw(data(d) * mapping(color=:name) * (scatter_lines + labels);
     axis=(width=400, height=300))

```

![image](https://global.discourse-cdn.com/julialang/original/3X/d/6/d61d2773c1368cdc8ca2a1fce2b1c71cc2a5699c.png)

Remarks

- It would be nice to see [Makie #1193](https://github.com/JuliaPlots/Makie.jl/pull/1193) finalized so we don’t need to map x and y twice in different ways
- I guess that would also fix the lost x label
- It feels a bit random when `verbatim` is required and when not (why for text values and `offset` but not `position`?)
- We can use `visual(ScatterLines)` instead of `Scatter` + `Lines` but I’d wait until AoG is updated to Makie 0.16 (it fixes a color issue)
- To use this in Weave use CairoMakie instead of GLMakie

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 25, 2022, 11:20am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/14 "2022-01-25T11:20:43Z")

</div>

Thanks a lot @sijo and @fabgrei . It looks like AoG could become the “ggplot for Julia”. It would indeed be great with a more unified syntax. I’m still not quite sure how to parse the mapping for the Text / Annotations visual. Are they actually the same (Text and Annotations)?

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [January 25, 2022, 11:48am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/15 "2022-01-25T11:48:57Z")

</div>

According to the discussion in [Makie #1193](https://github.com/JuliaPlots/Makie.jl/pull/1193) `Annotations` is now a wrapper for `Text` and will be deprecated.

To understand the mapping: every visual has a corresponding Makie method with documented arguments. The `Text` visual corresponds to the [`text`](https://makie.juliaplots.org/stable/examples/plotting_functions/text/index.html) method.

In the current Makie version, `text` takes:

- a single positional argument for the text (as string)
- an optional `position` keyword argument for the position (as `Point`)
- an optional `offset` keyword argument (as `(x,y)` tuple)
- …

(in each case we can give `text` a vector instead of a single value.)

This is directly reflected in our `mapping` call:

```julia
mapping(:name => verbatim,
        position=:point,
        offset=:offset => verbatim)

```

- We give `:name` as positional argument (that’s the column holding the strings). The `=> verbatim` transformation is added so the value is used “as is”.
- The `position` keyword is used to specify the column holding the points. I used a column with pre-computed points, while @fabgrei computed the point with a transformation that takes two values as input: `position=(:time, :value) => Point` (because the `Point` method takes two values to make a point).
- The `offset` keyword is used to specify the column holding precomputed offsets. Here it seems we need `verbatim` again.

The `verbatim` thing is bit annoying… I don’t know the rule for when it’s required, so I just try to add one if it doesn’t work without. Maybe @piever can explain why and when it’s required…

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [January 25, 2022, 12:21pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/16 "2022-01-25T12:21:07Z")

</div>

So, annotations with AlgebraOfGraphics are somewhat annoying for the two reasons described above:

- The signature is non-standard (rather than just `text(x, y, labels=labels)`, which would be more in line with `scatter`)
- One of the arguments is a vector of strings, which triggers the need for `verbatim`.

The first problem should be more straightforward to solve (see [this PR](https://github.com/JuliaPlots/Makie.jl/pull/1193)).

The second one is trickier. The main issue is that AlgebraOfGraphics treats any vector it does not recognize as “numeric” (mostly `AbstractVector{<:Number}`) or “geometric” (lists of points, or polygons, etc…) as a “categorical vector”, which in turns triggers a conversion from categorical values to integers (as well as grouping of the data).

`verbatim` is a way to escape that, because, in the case of `annotations` or `text`, the categorical vector (vector of strings) is what we want to pass to the plot directly, as Makie can handle that. There is an [issue](https://github.com/JuliaPlots/AlgebraOfGraphics.jl/issues/300) open to track this, but I’m not yet 100% sure what the best solution is.

One possible way forward (once labels in `annotations` or `text` are passed as a keyword argument), could be to only consider a keyword argument categorical if there exists a `palette` (categorical scale) for it. That does add some complexity (as categorical variables determine how the data is grouped, which is relevant to compute analyses, and would now depend on the choice of scales), but it would avoid the “aggressive conversion pipeline”.

From what I understand, ggplot2 fixes this by “hardcoding” the plot attributes that cause grouping (see [here](https://ggplot2.tidyverse.org/reference/aes_group_order.html)), but I would prefer a more flexible approach. We could still get something like that by default, because those would be variables with built-in palettes.

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [January 25, 2022, 1:36pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/17 "2022-01-25T13:36:42Z")

</div>

Thanks a lot @sijo and @piever. This makes it a lot clearer how it works.  
I’ll definitely look more into AlgebraOfGraphics.

While ggplot2 is far from perfect, I think they do a good job at setting defaults that give a reasonable result most of the 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:** [September 29, 2022, 8:19am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/18 "2022-09-29T08:19:05Z")

</div>

Update: The signature of `Text` is now standard, so it takes `x, y, text = text` which means a `mapping` call could look like `mapping(:x, :y, text = :text => verbatim) * visual(Text)`

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [September 29, 2022, 5:46pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/19 "2022-09-29T17:46:48Z")

</div>

Thanks for following up on this @jules

Is this in an upcoming version, or should it work now?

Doing this:

```julia
using AlgebraOfGraphics, GLMakie
using Random, DataFrames
Random.seed!(123)
d = DataFrame(name = repeat(["A","B","C","D","E","F"], inner=4), 
      time=repeat([0,1,3,6], outer=6), value = rand(24));

plt = data(d) * (visual(Scatter) + visual(Lines) + visual(GLMakie.Text)) * mapping(:time, :value, color = :name, text = :name => verbatim) ;

AlgebraOfGraphics.draw(plt)

```

I get a stacktrace starting with:

```julia
Error showing value of type AlgebraOfGraphics.FigureGrid:
ERROR: MethodError: no method matching gl_convert(::Vector{String})
Closest candidates are:
  gl_convert(::T) where T<:ColorTypes.Colorant at ~/.julia/packages/GLMakie/K6iJk/src/GLAbstraction/GLUniforms.jl:194
  gl_convert(::Quaternion) at ~/.julia/packages/GLMakie/K6iJk/src/glshaders/particles.jl:30
  gl_convert(::StaticArraysCore.SMatrix{N, M, T}) where {N, M, T} at ~/.julia/packages/GLMakie/K6iJk/src/GLAbstraction/GLUniforms.jl:230

```

Also, if I write  
`visual(Text))`  
I get this error:

```julia
WARNING: both GLMakie and Base export "Text"; uses of it in module Main must be qualified
ERROR: UndefVarError: Text not defined

```

Am I doing it wrong?

---

<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:** [September 29, 2022, 7:32pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065/20 "2022-09-29T19:32:38Z")

</div>

Use `Makie.Text` to avoid the ambiguity error, Base has its own `Text` which is a little annoying for us. And I think the problem is that you use your mapping with `text = ...` on Scatter, Lines and Text at the same time, so it errors for Scatter or Lines probably which pass through the unused attribute until GLMakie chokes.

[Next page](https://discourse.julialang.org/t/how-to-make-this-plot-in-julia/75065.md?page=2)
