# Compose.jl text error

**URL:** <https://discourse.julialang.org/t/compose-jl-text-error/33105>\
**Category:** Visualization\
**Created:** [January 8, 2020, 3:55pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105 "2020-01-08T15:55:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simplex](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simplex/32/12188_2.png) [@Simplex](https://discourse.julialang.org/u/Simplex)\
**Post date:** [January 8, 2020, 3:55pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105/1 "2020-01-08T15:55:08Z")

</div>

I try to use compose.jl to represent a network. But I also want to write text next to it but I have an error using text.

I also tried to fix the network to make it not move at each iteration but it didn’t work.

Thanks for your help

```julia
using Plots
using GraphPlot
using LightGraphs
using Compose,Measures #Pour sauver l'image
using Printf #Pour sauver l'image
import Cairo #Pour sauver l'image Attention pas using
anim=Animation()
g = graphfamous("karate")
for i in 1:10
    p=gplot(g)
    output = compose(p,
        (context(), text(1, 1, "Julia", hcenter, vcenter), stroke("red"), fontsize(30pt)),
        (context(), rectangle(), fill("white")))
    j=length(anim.frames)+1
    tmpfilename=joinpath(anim.dir,@sprintf("%06d.png",j))
    draw(PNG(tmpfilename),output)
    push!(anim.frames, tmpfilename)
end
gif(anim, "anim_test.gif", fps = 5)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/c/1/c1ea8685d33f03e72c86288fb013414a8d5ad4fc.png)

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 8, 2020, 4:58pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105/2 "2020-01-08T16:58:59Z")

</div>

Hi there! I’d suggest including any `using` statements at the beginning of your code (since it will probably help people know which packages you’re using). People might then be able to copy/paste your code and run it to see what’s up.

Edit: that’s better…

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 8, 2020, 7:13pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105/3 "2020-01-08T19:13:41Z")

</div>

```julia
using Plots
using GraphPlot
using LightGraphs
using Compose,Measures #Pour sauver l'image
using Printf #Pour sauver l'image
import Cairo #Pour sauver l'image Attention pas using
anim=Animation()
g = graphfamous("karate")
for i in 1:10
    p=gplot(g)
    output = compose(p,
        (context(), Compose.text(1, 1, "Julia")),
        (context(), rectangle(), fill("white")))
    j=length(anim.frames) + 1
    tmpfilename=joinpath(anim.dir,@sprintf("%06d.png",j))
    Compose.draw(PNG(tmpfilename),output)
    push!(anim.frames, tmpfilename)
end
gif(anim, "anim_test.gif", fps = 5)

```

So this ↑ works, but the few changes I made probably need investigating to find out what’s wrong. (Probably shouldn’t have changed more than one thing at a time… 🙂)

---

<div class="post-metadata">

**Author:** ![Simplex](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simplex/32/12188_2.png) [@Simplex](https://discourse.julialang.org/u/Simplex)\
**Post date:** [January 8, 2020, 7:22pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105/4 "2020-01-08T19:22:18Z")

</div>

Thanks ! Do you know how to make the network unmovable ?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 8, 2020, 7:25pm UTC](https://discourse.julialang.org/t/compose-jl-text-error/33105/5 "2020-01-08T19:25:58Z")

</div>

I know ε about graphs, sorry. 😄
