Cannot get the following code to do all three things:
- stop at the debug breakpoint
- render the figure
- return control to the console with the figure rendered (in debugger mode)
import matplotlib.pyplot as plt
from ipdb import set_trace
fig, ax = plt.subplots()
ax.plot(range(10))
plt.show()
set_trace()
The use case to do all three things simultaneously is debugging inside of a module that requires information in the matplotlib visualization.
Running IPython from the console as ipython --pylab
accomplishes (1) and (3) above only, as shown below. Using plt.ion()
in the code does the same. The debugger is available but the visualization will not render.
Running IPython from the console as just ipython
, or running python <script.py>
, accomplishes (1) and (2) above only, as shown below. The visualization has rendered but the debugger is not available.
Right now I am using python 3.7.7
, matplotlib 3.1.3
with Qt5Agg
backend, ipython 7.13.0
, and ipdb 0.12.3
.