0

In this link, they explain how to use subplots and save the result as an .mp4 file. It works great. However, it saves the video as if the window were not maximized. here, they explain how to automatically maximize when displaying, that is, when using plt.show(), which works. But again, when saving automatically by using .save, it does not save the maximized the version. Does anyone know how to do that (if it is not too complicated)?

Thanks!

Schach21
  • 412
  • 4
  • 21

1 Answers1

1

You can obtain the dimensions you want by adjusting figsize using:

fig, ax = plt.subplots(figsize=(20, 10))

where 20 and 10 are respectively width and height of the figure in inches and you can also provide a dpi option (defaults to 100) :

fig, ax = plt.subplots(figsize=(20, 10), dpi=80)

When you save the figure, dpi option is still available:

plt.savefig("test.png", dpi=80)

For animations, it's the same:

ani.save("test.mp4", dpi=80)
david
  • 1,302
  • 1
  • 10
  • 21