semiautomaticgit/SemiAutomaticClassificationPlugin

Spectral signature plot not produced : bug

GITHUBAntoineDENIS opened this issue · 4 comments

Hello,
When trying to create the graph of spectral signature with scp

STACK TRACE:
Une erreur est survenue lors de l'exécution du code Python :

AttributeError: 'ArtistList' object has no attribute 'pop'
Traceback (most recent call last):
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\interface\scp_dock.py", line 2639, in add_signature_to_spectral_plot
cfg.spectral_signature_plotter.signature_list_plot_table()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 278, in signature_list_plot_table
self.signature_plot()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 306, in signature_plot
self.ax.lines.pop(i)
^^^^^^^^^^^^^^^^^
AttributeError: 'ArtistList' object has no attribute 'pop'

Version de Python : 3.12.3 (main, Apr 14 2024, 17:21:43) [MSC v.1938 64 bit (AMD64)]
Version de QGIS : 3.34.6-Prizren Prizren, 623828f5

Chemin Python :
C:/PROGRA1/QGIS331.6/apps/qgis-ltr/./python
C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA1/QGIS331.6/apps/qgis-ltr/./python/plugins
C:\PROGRA1\QGIS331.6\apps\grass\grass83\etc\python
C:\TP_SIG_TELED\TELED\5_CLASSIFICATION_SUPERVISEE_ANALYSE_DIACHRONIQUE
C:\Program Files\QGIS 3.34.6\bin\python312.zip
C:\PROGRA1\QGIS331.6\apps\Python312\DLLs
C:\PROGRA1\QGIS331.6\apps\Python312\Lib
C:\Program Files\QGIS 3.34.6\bin
C:\PROGRA1\QGIS331.6\apps\Python312
C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages
C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\win32
C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\win32\lib
C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\Pythonwin
C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/TP_SIG_TELED/TELED/5_CLASSIFICATION_SUPERVISEE_ANALYSE_DIACHRONIQUE


PYTHON ERROR
2024-05-17T09:06:10 WARNING Traceback (most recent call last):
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\interface\scp_dock.py", line 2639, in add_signature_to_spectral_plot
cfg.spectral_signature_plotter.signature_list_plot_table()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 278, in signature_list_plot_table
self.signature_plot()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 306, in signature_plot
self.ax.lines.pop(i)
^^^^^^^^^^^^^^^^^
AttributeError: 'ArtistList' object has no attribute 'pop'

PYTHON ERROR
2024-05-17T08:59:08 WARNING Traceback (most recent call last):
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\interface\scp_dock.py", line 2639, in add_signature_to_spectral_plot
cfg.spectral_signature_plotter.signature_list_plot_table()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 278, in signature_list_plot_table
self.signature_plot()
File "C:\Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\spectral_signature\spectral_signature_plot.py", line 414, in signature_plot
self.ax.set_xticks(wavelengths_list)
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\matplotlib\axes_base.py", line 73, in wrapper
return get_method(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\matplotlib\axis.py", line 2138, in set_ticks
result = self._set_tick_locations(ticks, minor=minor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\matplotlib\axis.py", line 2078, in _set_tick_locations
locator = mticker.FixedLocator(ticks) # validate ticks early.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\matplotlib\ticker.py", line 1700, in init
api.check_shape((None,), locs=self.locs)
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\matplotlib_api_init
.py", line 161, in check_shape
raise ValueError(
ValueError: 'locs' must be 1D with shape (N,), but your input has shape ()

image

Hello @GITHUBAntoineDENIS ,

thank you for reporting this. It seems an issue related to a new version of Matplotlib.
I'll try to fix it. In the meantime you can try to install an older version of QGIS which should include an older version of Matplotlib too.

Olá, também estou passando pela mesma situação !! Qual seria a melhor versão para realizar a classificação?

Olá, também estou passando pela mesma situação !! Qual seria a melhor versão para realizar a classificação?

Hello @Juliana9 , you can try QGIS version 3.28 https://download.qgis.org/downloads/QGIS-OSGeo4W-3.28.15-1.msi