# Question about Animation?

**URL:** https://discourse.julialang.org/t/question-about-animation/81795
**Category:** General Usage
**Tags:** plots, animations
**Created:** [May 27, 2022, 4:03pm UTC](https://discourse.julialang.org/t/question-about-animation/81795 "2022-05-27T16:03:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)
#### Post date: [May 27, 2022, 4:03pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/1 "2022-05-27T16:03:55Z")

</div>

Dear all,

I have set the color of bar to `red` ,but I always get the color of grey. What’s wrong with this problem?

```julia
using DataFrames
using CSV
using Plots
using PlotThemes

df = DataFrame(CSV.File("gdp.csv", header=true))
sort!(df, :Year)

theme(:dark)
p = bar(df.Year, zeros(nrow(df)), ylim=(0, maximum(df.GDP)),
    leg=false, xlabel="Year", ylabel="GDP", c=:white)

anim = Animation()

for x in range(1, nrow(df), step=1)
    bar!(p, [df.Year[x]], [df.GDP[x]], c = :red)
    frame(anim)
end

gif(anim, "gdp.gif", fps = 15)

```

![gdp](https://global.discourse-cdn.com/julialang/original/3X/f/f/ff194898ddd4cd185b0725a45c689c4fb9026027.gif)

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [May 27, 2022, 4:22pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/2 "2022-05-27T16:22:35Z")

</div>

The correct argument is `color`, not `c`.

```julia
    bar!(p, [df.Year[x]], [df.GDP[x]], color = :red)

```

---

<div class="post-metadata">

### Author: ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)
#### Post date: [May 27, 2022, 4:26pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/3 "2022-05-27T16:26:00Z")

</div>

It does not work. The color is still grey.

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [May 27, 2022, 5:10pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/5 "2022-05-27T17:10:15Z")

</div>

Humpf. I got one glorious all red plot the first time I tried. Now I get one red bar and the rest white with either `c` or `color`.

What versions are you using?

```julia
(dfenv) pkg> st
      Status `~/Desktop/Julia/dfenv/Project.toml`
  [336ed68f] CSV v0.10.4
  [a93c6f00] DataFrames v1.3.4
  [ccf2f8ad] PlotThemes v3.0.0
  [91a5bcdd] Plots v1.29.0

```

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [May 27, 2022, 5:22pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/6 "2022-05-27T17:22:43Z")

</div>

Plotting one at a time in the REPL gets the correct red bars, using `@animate` or `frame` like this example always results in a .gif with the first bar red and the rest white. I am stumped, sorry.

---

<div class="post-metadata">

### Author: ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)
#### Post date: [May 27, 2022, 5:37pm UTC](https://discourse.julialang.org/t/question-about-animation/81795/7 "2022-05-27T17:37:49Z")

</div>

The problem is solved. Maybe it’s the problem of Vscode. Now It display the correct color. Thanks for your help.
