You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If Axis.grid(visible=True) is used instead of Axis.grid(), it will generate a TypeError. The same goes for if Axis.grid(visible=False).
This is due to the Tick class's (axis.py) init function, where in line 159 it creates the gridlines with mlines.Line2D(), where it feeds it the visible argument with the value gridOn. When visible is fed into Axis.grid(), it looks like there is no check for that, and thus it feeds mlines.Line2D() with the visible argument in grid_kw even though visible is already seperatly set.
Traceback (most recent call last):
File "/run/media/electro/ELECTRO/Work_SMD/Local_Copy/903-8318 - Mini Deltec Test Software/Matplotlib Bug/main2.py", line 15, in <module>
canvas.draw()
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/backends/backend_tkagg.py", line 9, in draw
super(FigureCanvasTkAgg, self).draw()
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 407, in draw
self.figure.draw(self.renderer)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/figure.py", line 1863, in draw
mimage._draw_list_compositing_images(
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py", line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1164, in draw
ticks_to_draw = self._update_ticks()
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1023, in _update_ticks
major_ticks = self.get_major_ticks(len(major_locs))
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1382, in get_major_ticks
tick = self._get_tick(major=True)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 2013, in _get_tick
return XTick(self.axes, 0, major=major, **tick_kw)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 417, in __init__
super().__init__(*args, **kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py", line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File "/home/electro/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 159, in __init__
self.gridline = mlines.Line2D(
TypeError: type object got multiple values for keyword argument 'visible'
Expected outcome
As the keyword visible is to change the grid's Line2D properties, Axis.grid(True) and Axis.grid(visible=True) should have the same outcome. Either that or it should noted in the Axis.grid documentation to not use the visible kwargs. I personally think it should be the former.
Bug report
Bug summary
If Axis.grid(visible=True) is used instead of Axis.grid(), it will generate a TypeError. The same goes for if Axis.grid(visible=False).
This is due to the Tick class's (axis.py) init function, where in line 159 it creates the gridlines with mlines.Line2D(), where it feeds it the visible argument with the value gridOn. When visible is fed into Axis.grid(), it looks like there is no check for that, and thus it feeds mlines.Line2D() with the visible argument in grid_kw even though visible is already seperatly set.
Code for reproduction
Actual outcome
Expected outcome
As the keyword visible is to change the grid's Line2D properties, Axis.grid(True) and Axis.grid(visible=True) should have the same outcome. Either that or it should noted in the Axis.grid documentation to not use the visible kwargs. I personally think it should be the former.
Matplotlib version
print(matplotlib.get_backend())
): matplotlibThe text was updated successfully, but these errors were encountered: