USEPA / SWMM-EPANET_User_Interface

User interface for the Stormwater-Management-Model
111 stars 66 forks source link

Creating plots can fail if you have viewed a timeseries #353

Closed barrc closed 4 years ago

barrc commented 4 years ago

To reproduce:

If you skip viewing the timeseries, you can create a scatter plot or timeseries plot.

Traceback (most recent call last):
  File "site-packages\matplotlib\figure.py", line 432, in show
AttributeError: 'CurvePlot' object has no attribute 'manager'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "frmTimeSeriesPlot.py", line 91, in cmdOK_Clicked
  File "core\graph.py", line 123, in plot_time
  File "site-packages\matplotlib\pyplot.py", line 253, in show
  File "site-packages\matplotlib\backend_bases.py", line 3248, in show
  File "site-packages\matplotlib\figure.py", line 437, in show
AttributeError: 'CurvePlot' object has no attribute 'manager'
Figure.show works only for figures managed by pyplot, normally created by pyplot.figure().
'CurvePlot' object has no attribute 'manager'
Figure.show works only for figures managed by pyplot, normally created by pyplot.figure().
None

Version: SWMM MTP6r2 and dev-ui-py3qt5

barrc commented 4 years ago

This stackoverflow comment makes it sound like we shouldn't be importing pyplot? Maybe see this tutorial. At some points the GUI is using matplotlib.figure instead of plt.figure (where plt is matplotlib.pyplot).

PaulDudaRESPEC commented 4 years ago

It looks like the plots produced by frmPlotViewer.py (like the timeseries editor) have this issue. I suspect an upgrade to matplotlib has something to do with it, because this all worked not long ago. I think the solution may to follow the model of the output timeseries and scatter plots.

PaulDudaRESPEC commented 4 years ago

The commit referenced above satisfies the initial issue. You can now: run Example1.inp go to timeseries editor and view the timeseries create a scatter plot or timeseries plot!