# Load GIF files into plot

**URL:** https://discourse.julialang.org/t/load-gif-files-into-plot/72101
**Category:** New to Julia
**Tags:** question, plotting
**Created:** [November 26, 2021, 9:54am UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101 "2021-11-26T09:54:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![libensvivit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libensvivit/32/19006_2.png) [@libensvivit](https://discourse.julialang.org/u/libensvivit)
#### Post date: [November 26, 2021, 9:54am UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101/1 "2021-11-26T09:54:10Z")

</div>

Hello!

I have results of a simulation saved as GIF files on my disk and I want to use a suitable plotting library to load and plot them with the x, y axes having specific values, the exported image will also be a GIF file.  
So far, I tried loading the file with FileIO and plotting in Plots, PyPlot, Makie but neither of them accepts a GIF file for plotting or I was unable to see a result.

Is there a library or a working example for what I’m trying to do?

Thanks!

---

<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: [November 26, 2021, 12:54pm UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101/2 "2021-11-26T12:54:30Z")

</div>

For the first part of your question, loading static gifs and plotting on them:

```julia
using FileIO, Plots; gr(dpi=300)
file = "moonsurface.gif"
pgif = load(file)
heatmap(pgif, legend=false)
plot!(x -> rand(1200:1400) + rand(1:40)*sin(x/100), c=:red, widen=false)
title!("Houston, we have a problem")

```

 ![Houston_we_have_a_problem](https://global.discourse-cdn.com/julialang/original/3X/d/0/d0edadd9f21149698779ec54f4d79ff1a45e7ccc.png)

---

<div class="post-metadata">

### Author: ![libensvivit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libensvivit/32/19006_2.png) [@libensvivit](https://discourse.julialang.org/u/libensvivit)
#### Post date: [November 26, 2021, 1:34pm UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101/3 "2021-11-26T13:34:03Z")

</div>

Hmm now that’s interesting, I remember trying this before posting the question.  
Running your code gave me the same error as before.

`ERROR: Cannot convert Array{RGB{FixedPointNumbers.N0f8}, 3} to series data for plotting`

Is something wrong with my GIF file?

---

<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: [November 26, 2021, 1:54pm UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101/4 "2021-11-26T13:54:47Z")

</div>

FWIW, the gif file I used, loaded as:  
`Array{RGB{N0f8},2} with eltype RGB{FixedPointNumbers.N0f8}`

---

<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 26, 2021, 1:59pm UTC](https://discourse.julialang.org/t/load-gif-files-into-plot/72101/5 "2021-11-26T13:59:27Z")

</div>

Looks a bit like you have an animated gif that loads as a 3D array of pixels? Maybe it’s not animated but it still reads that way, you could try reshaping so the third singleton dimension goes away, or just index into the first dimension like `img = gifdata[:, :, 1]`/
