Skip to content

Resolve "Eliminate deprecation warning in safefig function within _movie_writers.py"

This MR replaces the file_format kwarg with the format kwarg in the plt.savefig function within _movie_writers.py.

Details

Interestingly, this was a bug that had no influence. 😁 As far as I understand now, the file_format kwarg was never a valid kwarg for the savefig function. Hence, it was ignored. The deprecation warning seems to be a result of passing kwargs that are no arguments of the savefig function. In future, matplotlib versions they appear to be checking for validity of input quarks. We get exactly the same deprecation warning when running the tests and passing spam or some_bad_value to the savefig function. They are accepted, but not used, and therefore do not do anything.

In this case, this did not have an impact because the file format was always correctly deduced from the first argument (fname - the file name) where we already set the file format.

So, there are two possibilities here to remove the 'bug': I chose to still pass on the format to savefig although it is kind of redundant in our usecases. However, if the fname should for some user not contain the format, this would allow for the possibility to set it.

The alternative would be to completely remove the format kwarg.

Anything to double-check?

  • see details section. Is the chosen approach ok?
  • Should we cope with the other warnings arising from passing spam and some_bad_value to the animation writer in this MR or rather in #213 's MR?

Can this MR be accepted?

  • Implementation ready
  • Tests added or adjusted
  • Code quality
  • Ready for merging
    • Pipeline passes without warnings
    • History cleaned-up or squash option set
    • Changelog entry added
    • Version number bumped
    • Reviewed & approved by @blsqr

Related issues

Closes #215 (closed)

Edited by Utopia Developers

Merge request reports