pytroll / pytroll/pyresample

MatplotlibDeprecationWarning in plotting tests

Open
#240 3 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

enhancement PCW
Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

Code Sample, a minimal, complete, and verifiable piece of code
# Your code here
python -m unittest pyresample.test.test_plot.Test.test_plate_carreeplot
Problem description

As discussed with @djhoese

The problem in the test is that we are recreating the axes inside the quicklook code multiple times and matplotlib can't tell the difference. I think we could (should?) allow the user to pass an ax argument to the quicklook function that will be drawn to. That way, the test could either reuse the same ax for the 3 different quicklook calls it makes or create a new one if needed.

This ax could let users add multiple quicklooks to one figure which would be nice

Currently the user function show_quicklook doesn't return anything.

Expected Output

The unittests should not shout out about any warnings.

Actual Result, Traceback if applicable
...plot.py:259: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  ax = plt.axes(projection=ccrs)
Versions of Python, package at hand and relevant dependencies

Matplotlib 3.1.1
Cartopy 0.17.0
Python 3.7.3
Latest Pyresample master branch: pyresample-1.12.3+214.g19ff793.tar.gz

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.