# Having trouble making a table of plots

My problem is very simple. I'm trying to create an animation with a function's plot. Here is my code:

Azul := RGBColor["#19A3CD"]
f[x_] := Piecewise[{{(x - 3)^3 + 2 (x - 3)^2 + 3, 0 <= x <= t}, {0,
x > t}}]
funcao :=
Plot[f[x], {x, -0.6, 5}, PlotStyle -> Thickness[0.006],
Background -> Black]

PlotSet := {PlotStyle -> {Thickness[0.006], Azul},
AxesStyle -> Directive[White, Thickness[0.005]],
PlotRange -> {-0.2, 6},
Ticks -> {{{1, 1, 0.04}, {2, 2, 0.04}, {3, 3, 0.04}, {4, 4,
0.04}, {5, 5, 0.05}}, {{1, 1, 0.04}, {2, 2, 0.04}, {3, 3,
0.04}, {4, 4, 0.04}, {5, 5, 0.04}, {6, 6, 0.04}}},
TicksStyle ->
Directive[White, Bold, FontSize -> 48, FontColor -> White,
FontFamily -> "Montserrat"], ImageSize -> {1920, 1080}}
A := Show[funcao, Axes -> True, Evaluate@PlotSet]
GraficoAnimado = Table[A, {t, 0, 4.5, 0.1}]


And, at the beggining, the first plots looks ok, like this one:

But the nexts plots completely lose the pattern, like this one:

And, after some time, the plots continue ok.

Why on the earth is this happening?

• Table localizes the variable t. Therefore, make A[t] a function of t. And also funcao[t] and f[x,t] Nov 3 '20 at 21:13
• @DanielHuber I did it, and the problem is still there. Could you try to run it in your Mathematica, and see what happens? Because I really think it is a bug. Nov 3 '20 at 22:13

Your code is over complicated and buggy. Here is a simple way of writing what you want.

Azul = RGBColor["#19A3CD"];
ticks = {#, #, .04} & /@ Range[6];
f[x_] := (x - 3)^3 + 2 (x - 3)^2 + 3
plot[t_] :=
Plot[f[x], {x, -0.6, t},
PlotStyle -> Directive[Azul, Thickness[0.006]],
Background -> Black,
AxesStyle -> Directive[White, Thickness[0.005]],
PlotRange -> {{-0.5, 5.1}, {-0.5, 6.2}},
Ticks -> {Most @ ticks, ticks},
TicksStyle -> Directive[White, Bold, 48, FontFamily -> "Montserrat"],
ImageSize -> {1920, 1080}]
GraficoAnimado = Table[plot[t], {t, 0.5, 4.5, 0.1}];


The table of plots is too big to show in full, but here is what the first, 20th, and last plots look like.

Magnify[Column[GraficoAnimado[[{1, 20, -1}]], Spacings -> 5], .33]


• It worked. Thank you! Nov 3 '20 at 23:34

The following gives you a Manipulate within which you can just run an animation.

Manipulate[
Plot[
Piecewise[{{(x - 3)^3 + 2 (x - 3)^2 + 3, 0 <= x <= t}, {0,
x > t}}],
{x, -0.6, 5},
Axes -> True,
PlotStyle -> {Thickness[0.006], RGBColor["#19A3CD"]},
AxesStyle -> Directive[White, Thickness[0.005]],
PlotRange -> {-0.2, 12},
TicksStyle ->
Directive[White, Bold, FontSize -> 10, FontColor -> White,
FontFamily -> "Montserrat"],
ImageSize -> {1920/4, 1080/4}, Background -> Black
],
{t, 0, 4.5, 0.1}
]


OR... Simply change the Head of the above to Table:

Table[
Plot[
Piecewise[{{(x - 3)^3 + 2 (x - 3)^2 + 3, 0 <= x <= t}, {0,
x > t}}],
{x, -0.6, 5},
Axes -> True,
PlotStyle -> {Thickness[0.006], RGBColor["#19A3CD"]},
AxesStyle -> Directive[White, Thickness[0.005]],
PlotRange -> {-0.2, 12},
TicksStyle ->
Directive[White, Bold, FontSize -> 10, FontColor -> White,
FontFamily -> "Montserrat"],
ImageSize -> {1920/4, 1080/4}, Background -> Black
],
{t, 0, 4.5, 0.1}
]


Which will give you all of the individual Plots.

• sorry, that's not what I need. I know that I can do an animation with manipulation, but for now, I need the table with all the plots Nov 3 '20 at 20:43

I am running MMA 12.0. The following code, using functions instead of expressions gives (I made the image size and font smaller because I do not have a XXL monitor).

Azul := RGBColor["#19A3CD"]
f[x_, t_] :=
Piecewise[{{(x - 3)^3 + 2 (x - 3)^2 + 3, 0 <= x <= t}, {0, x > t}}]
funcao[t_] :=
Plot[f[x, t], {x, -0.6, 5}, PlotStyle -> Thickness[0.006],
Background -> Black]

PlotSet := {PlotStyle -> {Thickness[0.006], Azul},
AxesStyle -> Directive[White, Thickness[0.005]],
PlotRange -> {-0.2, 6},
Ticks -> {{{1, 1, 0.04}, {2, 2, 0.04}, {3, 3, 0.04}, {4, 4,
0.04}, {5, 5, 0.05}}, {{1, 1, 0.04}, {2, 2, 0.04}, {3, 3,
0.04}, {4, 4, 0.04}, {5, 5, 0.04}, {6, 6, 0.04}}},
TicksStyle ->
Directive[White, Bold, FontSize -> 4.8, FontColor -> White,
FontFamily -> "Montserrat"], ImageSize -> {192, 108}}
A[t_] := Show[funcao[t], Axes -> True, Evaluate@PlotSet]
GraficoAnimado = Table[A[t], {t, 0, 4.5, 0.1}]