# Question: Can I modify and save figures without regenerating each from scratch?

**URL:** https://forum.generic-mapping-tools.org/t/question-can-i-modify-and-save-figures-without-regenerating-each-from-scratch/3488
**Category:** PyGMT Q&A
**Created:** [November 27, 2022, 8:13pm UTC](https://forum.generic-mapping-tools.org/t/question-can-i-modify-and-save-figures-without-regenerating-each-from-scratch/3488 "2022-11-27T20:13:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ianfoster](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@ianfoster](https://forum.generic-mapping-tools.org/u/ianfoster)
#### Post date: [November 27, 2022, 8:13pm UTC](https://forum.generic-mapping-tools.org/t/question-can-i-modify-and-save-figures-without-regenerating-each-from-scratch/3488/1 "2022-11-27T20:13:40Z")

</div>

I want to generate a sequence of PNGs that I will then turn into an animation with ffmpeg. With matplotlib, I can do this roughly as below. Can I do similar things with GMT?

import matplotlib.pyplot as plt  
plt.figure()  
… Add a bunch of stuff to the figure …

for index in range(1000): # Create a sequence of images with numbers 0…1000  
text\_ptr = plt.text(x, y, f’{index}’)  
plt.savefig(f’fig{index:03}.png’  
text\_ptr.remove() # Remove 'previous text

… create animation by using the resulting 1000 .png files

---

<div class="post-metadata">

### Author: ![KristofKoch](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/kristofkoch/32/314_2.png) [@KristofKoch](https://forum.generic-mapping-tools.org/u/KristofKoch)
#### Post date: [November 27, 2022, 9:17pm UTC](https://forum.generic-mapping-tools.org/t/question-can-i-modify-and-save-figures-without-regenerating-each-from-scratch/3488/2 "2022-11-27T21:17:24Z")

</div>

Hi Ian, welcome to the GMT universe.

I’m sure you found the [`movie` module](https://docs.generic-mapping-tools.org/latest/movie.html) already. I’m not quite sure I understood your objective: You want to animate text superimposed on your static plot?

You could achieve something like this in [classic mode](https://docs.generic-mapping-tools.org/latest/modules-classic.html): Generate the plot layer once and then all the frames with your text. Then bake them into your final frames. Be warned: classic mode is _very_ powerful and has an equally steep learning curve.

If you just want to animate some text over a static plot a detour into your favourite post production software might be the easiest solution. Just animate it right in there.

---

<div class="post-metadata">

### Author: ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)
#### Post date: [November 28, 2022, 8:23am UTC](https://forum.generic-mapping-tools.org/t/question-can-i-modify-and-save-figures-without-regenerating-each-from-scratch/3488/3 "2022-11-28T08:23:37Z")

</div>

Hi Ian, unfortunately the **movie** module has not been wrapped in PyGMT yet as it is nontrivial. For bash command line scripting and movie making you can see what can be done by visiting the [GMT YouTube channel](https://www.youtube.com/c/TheGenericMappingTools).
