psyplot / psyplot-gui

Graphical User Interface for the psyplot package
https://psyplot.github.io/psyplot-gui
7 stars 6 forks source link

AttributeError: 'PsyplotCanvasManager' object has no attribute '_get_toolbar' #32

Open dkobashi opened 1 year ago

dkobashi commented 1 year ago

Problem description

I tried to open ERA5 single level netcdf data to visualize on GUI; however, I had an error when I tried to plot a figure for a variable (e.g. u10).

Expected Output

When selecting a variable, psyplot should show the figure of the variable.

'PsyplotCanvasManager' object has no attribute '_get_toolbar' Traceback (most recent call last): File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psy_view\ds_widget.py", line 1055, in func self.make_plot() File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psy_view\ds_widget.py", line 1311, in make_plot self.sp = sp = self.plot(name=self.variable, **self.plot_options) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 2180, in __call__ return super(DatasetPlotterInterface, self).__call__(*args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 1983, in __call__ return self._project_plotter._add_data( File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 2222, in _add_data return super(DatasetPlotter, self)._add_data(plotter_cls, self._ds, File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 1772, in _add_data return self.project._add_data(*args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 180, in wrapper return func(self, *args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\project.py", line 801, in _add_data plotter_cls(arr, make_plot=(not bool(share) and make_plot), File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 1260, in __init__ self.initialize_plot(data, ax=ax, draw=draw, clear=clear, File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 1418, in initialize_plot self._plot_by_priority(fmto_priority, grouper, File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 1622, in _plot_by_priority update(fmto) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 1602, in update fmto.initialize_plot(fmto.value) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 659, in initialize_plot self.update(value, *args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psy_maps\plotters.py", line 1085, in update proj = self.ax.projection File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot\plotter.py", line 275, in ax return self.plotter.ax File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psy_maps\plotters.py", line 2099, in ax plt.figure() File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\matplotlib\_api\deprecation.py", line 454, in wrapper return func(*args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\matplotlib\pyplot.py", line 840, in figure manager = new_figure_manager( File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\matplotlib\pyplot.py", line 384, in new_figure_manager return _get_backend_mod().new_figure_manager(*args, **kwargs) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot_gui\backend.py", line 74, in new_figure_manager return new_figure_manager_given_figure(num, thisFig) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot_gui\backend.py", line 82, in new_figure_manager_given_figure return PsyplotCanvasManager(canvas, num) File "C:\Users\d.kobashi\AppData\Local\miniconda3\envs\psyplot\lib\site-packages\psyplot_gui\backend.py", line 109, in __init__ self.toolbar = self._get_toolbar(canvas, parent_widget) AttributeError: 'PsyplotCanvasManager' object has no attribute '_get_toolbar'

Output of psyplot -aV

# Paste the output of the command ``psyplot -aV`` (ran from the command line) psy_maps.plugin: requirements: cartopy: 0.21.1 version: 1.4.2 psy_reg.plugin: requirements: scipy: 1.10.1 statsmodels: 0.14.0 version: 1.4.0 psy_simple.plugin: version: 1.4.1 psyplot: requirements: matplotlib: 3.7.1 numpy: 1.24.3 pandas: 2.0.2 python: 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:28:38) [MSC v.1929 64 bit (AMD64)] xarray: 2023.5.0 version: 1.4.3 psyplot_gui: requirements: pyqt: 5.15.7 qt: 5.15.6 qtconsole: 5.4.3 version: 1.4.0
Chilipp commented 1 year ago

thanks for reporting @dkobashi! I assume it's a compatibility issue with the latest version of matplotlib. psyplot-gui needs an update here. As an immediate workaround, use matplotlib<3.6, e.g. via conda install -c conda-forge 'matplotlib<3.6'

Chilipp commented 1 year ago

as this is an issue for the psyplot-gui, I will transfer it to this repo