I have created a python program that uses matplotlib to plot data and it had been working fine until today, an error occured. The program uses AutoDateLocator and ConciseDateFormatter. As you can see in the last line of the error log below, the received error is:
> IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Since it would be really difficult to post more details about my program functionality as well as the data used, I was wondering if there is an obvious solution to the above-mentioned problem, or if you could guide me to where I should look for the problem.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\tkinter_init_.py", line 1883, in call
return self.func(*args)
File "C:\Users\Nick\Desktop\Uni\TUC studies\thesis\Code\python\test\myGUI_V3.py", line 841, in plotMeas
fig.tight_layout()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py", line 411, in
wrapper
return func(*inner_args, **inner_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 2613, in tight_layout kwargs = get_tight_layout_figure(
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py", line 303, in get_tight_layout_figure
kwargs = auto_adjust_subplotpars(fig, renderer,
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py", line 84, in
auto_adjust_subplotpars
bb += [ax.get_tightbbox(renderer, for_layout_only=True)]
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py", line 4155, in
get_tightbbox
bb_xaxis = self.xaxis.get_tightbbox(
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1109, in get_tightbbox
ticks_to_draw = self._update_ticks()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line 797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 480, in _draw_idle self.draw()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 407, in draw self.figure.draw(self.renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1863, in draw
mimage._draw_list_compositing_images(
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 131, in _draw_list_compositing_images a.draw(renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py", line 411, in wrapper return func(*inner_args, **inner_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py", line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 131, in _draw_list_compositing_images a.draw(renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1164, in draw
ticks_to_draw = self._update_ticks()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line 797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 480, in _draw_idle self.draw()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 407, in draw self.figure.draw(self.renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1863, in draw
mimage._draw_list_compositing_images(
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 131, in _draw_list_compositing_images a.draw(renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py", line 411, in wrapper return func(*inner_args, **inner_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py", line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 131, in _draw_list_compositing_images a.draw(renderer)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1164, in draw
ticks_to_draw = self._update_ticks()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line 797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed