1

I have a code that throws me some warnings.

...\matplotlib\axes\_base.py:3045: UserWarning: Attempting to set identical bottom==top results
in singular transformations; automatically expanding.

...\matplotlib\axes\_axes.py:519: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "

The second warning is not critical but the first one worries me, so I want to investigate why they are happening.

The problem is that since they are only warnings and not exceptions, I don't get a traceback, so I don't know which part of my code called the matplotlib\axes\_base.py.

Being a matplotlib\axes I can manually check my calls to matplotlib functions inside my code, put breakpoints and debug it, but it's manual digging and time consuming.

So my question is: Is there a way of forcing warnings to make the program throw and exception and therefore have a traceback of the functions that generated that warning?

  • Does the [`--verbose-debug` flag](https://matplotlib.org/3.1.0/faq/troubleshooting_faq.html#problems-with-recent-git-versions) help? – Sayse Jul 02 '19 at 09:08
  • @Sayse No, `--verbose-debug` doesn't give me more information about the caller function that generated the warnings –  Jul 02 '19 at 09:12
  • Possible duplicate of [In Python, how does one catch warnings as if they were exceptions?](https://stackoverflow.com/questions/5644836/in-python-how-does-one-catch-warnings-as-if-they-were-exceptions) – Sayse Jul 02 '19 at 09:14

0 Answers0