2
$\begingroup$

Code:

g1 = Manipulate[Plot[{Log[x], (x^(1-a)-1)/(1-a)}, {x, 0, 5}, PlotLegends->"Expressions"], 
{a, 0, 0.99}, LocalizeVariables->False]

ListAnimate[g1]

SetDirectory[NotebookDirectory[]]
Export["isoelastic.gif",g1]

Output (GIF):

enter image description here

As you can see, the .gif output does not show the animation at all (it just 'flashes'). Any ideas?


EDIT:

I'm wondering why this code, which is basically identical to the above, worked perfectly fine:

a1 = Manipulate[Plot[{(1-t)*x - t*((E^(-t*x)) - 1)}, {x, -100, 100}], {t, 0, 1}]

ListAnimate[a1]

SetDirectory[NotebookDirectory[]]
Export["graph.gif", a1]

Output:

enter image description here

$\endgroup$

closed as off-topic by Alexey Popkov, m_goldberg, rhermans, Kuba Oct 24 '18 at 12:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Alexey Popkov, m_goldberg, rhermans, Kuba
If this question can be reworded to fit the rules in the help center, please edit the question.

3
$\begingroup$

That's because when exporting to a gif, it actually takes a list of images. So what you actually want is

g1 = Table[
      Plot[{Log[x], (x^(1 - a) - 1)/(1 - a)}, {x, 0, 5}, PlotLegends -> "Expressions"],
      {a, 0, 0.99, .99/100}
     ]
$\endgroup$
  • 1
    $\begingroup$ Makes sense! I've edited my question - do you know why the code snippet below worked? (I've already accepted your answer even if you don't know). $\endgroup$ – Thevesh Theva Oct 20 '18 at 20:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.