Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/iclass: fix showing scatter plots #3169

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Sep 21, 2023

Describe the bug
Supervised Classification Tool does not show scatter plots and prints error message.

To Reproduce
Steps to reproduce the behavior:

  1. Launch Supervised Classification Tool wxGUI g.gui.iclass
  2. On the left Plots pane combobox widget choose Scatter plots item
  3. On the Scatter plots toolbar activate Add scatter plot tool
  4. On the Select imagery group dialog from the name of imagery group listbox widget items choose lsat7_2000
  5. Hit Create/edit group... button widget
  6. On the Create or edit image group dialog, type into Select existing subgroup or enter name of new subgroup combobox widget new subgroup name e.g. test and select some maps from the list to be part of the new cretaed subgroup test (lsat7_2000_10, lsat7_2000_20, lsat7_2000_30, lsat7_2000_40) and hit OK button
  7. Hit OK button on the Create or edit image group dialog
  8. On the next Add scatter plots dialog choose from the x axis combobox widget items lsat7_2000_10 raster map, and from the y axis combobox widget items choose lsat7_2000_20 raster map and hit Add button
  9. Repeat point 9. but with another maps, from the x axis combobox widget items choose lsat7_2000_30 raster map, and from the y axis combobox widget items choose lsat7_2000_40 raster map and hit Add button
  10. On the Add scatter plots dialog hit OK button
  11. See error

First error:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib64/grass84/gui/wxpython/core/gthread.py", line 151, in __run
    self.__run_backup()
  File "/usr/lib64/grass84/gui/wxpython/core/gthread.py", line 114, in run
    ret = vars()["callable"](*args, **kwds)
  File "/usr/lib64/grass84/gui/wxpython/iscatt/controllers.py", line 604, in _renderscattplts
    scatt["scatt"].Plot(
  File "/usr/lib64/grass84/gui/wxpython/iscatt/plots.py", line 234, in Plot
    img = imshow(
  File "/usr/lib64/grass84/gui/wxpython/iscatt/plots.py", line 1021, in imshow
    if not axes._hold:
AttributeError: 'Axes' object has no attribute '_hold'

Second error:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib64/grass84/gui/wxpython/core/gthread.py", line 151, in __run
    self.__run_backup()
  File "/usr/lib64/grass84/gui/wxpython/core/gthread.py", line 114, in run
    ret = vars()["callable"](*args, **kwds)
  File "/usr/lib64/grass84/gui/wxpython/iscatt/controllers.py", line 604, in _renderscattplts
    scatt["scatt"].Plot(
  File "/usr/lib64/grass84/gui/wxpython/iscatt/plots.py", line 234, in Plot
    img = imshow(
  File "/usr/lib64/grass84/gui/wxpython/iscatt/plots.py", line 1070, in imshow
    axes.images.append(im)
AttributeError: 'ArtistList' object has no attribute 'append'

Expected behavior
Supervised Classification Tool should show scatter plots without error message.

Screenshots

Expected behavior:

wxgui iclass scatter plots expected behavior

System description:

  • Operating System: all
  • GRASS GIS version: all
GRASS nc_spm_08_grass7/landsat:~ > python3 -c "import sys, matplotlib, wx; print(sys.version); print(wx.version()); print(f'{matplotlib.__version__} matplotlib')"
3.10.13 (main, Sep 16 2023, 22:24:59) [GCC 12.3.1 20230526]
4.2.0 gtk3 (phoenix) wxWidgets 3.2.2.1
3.7.2 matplotlib

Additional context

Matplotlib v3.0 API changes:

matplotlib.axes.Axes.hold doc:

https://matplotlib.org/2.2.5/api/_as_gen/matplotlib.axes.Axes.hold.html

@tmszi tmszi added bug Something isn't working GUI wxGUI related backport to 8.3 labels Sep 21, 2023
@tmszi tmszi added this to the 8.3.1 milestone Sep 21, 2023
@tmszi tmszi merged commit 59b3f9f into OSGeo:main Sep 22, 2023
18 checks passed
tmszi added a commit to tmszi/grass that referenced this pull request Sep 22, 2023
tmszi added a commit to tmszi/grass that referenced this pull request Sep 22, 2023
@tmszi tmszi deleted the wxgui-iclass-fix-show-scatter-plots branch September 22, 2023 03:24
landam pushed a commit to landam/grass that referenced this pull request Oct 25, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
HuidaeCho pushed a commit to HuidaeCho/grass that referenced this pull request Jan 9, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants