pygbif icon indicating copy to clipboard operation
pygbif copied to clipboard

Bug in maps module

Open sckott opened this issue 3 years ago • 1 comments

A pygbif user emailed me today, and I reproduced the error in the maps module.

from pygbif import maps
out = maps.map(taxonKey = 2435098)
out.plot()

gives the error

In [7]:         out.plot()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-b567a22407c0> in <module>
----> 1 out.plot()

~/github/sckott/pygbif/pygbif/maps/map.py in plot(self)
    216
    217     def plot(self):
--> 218         plt.show(self.img)
    219
    220

/opt/homebrew/lib/python3.9/site-packages/matplotlib/pyplot.py in show(*args, **kwargs)
    376     """
    377     _warn_if_gui_out_of_main_thread()
--> 378     return _backend_mod.show(*args, **kwargs)
    379
    380

TypeError: show() takes 1 positional argument but 2 were given

I changed this line https://github.com/gbif/pygbif/blob/master/pygbif/maps/map.py#L218 to be plt.show() and it then worked. I'm not sure if that's the best way to fix it

sckott avatar Aug 30 '21 15:08 sckott

I had the same issue and resolved it using your suggestion

alrichardbollans avatar Apr 04 '22 15:04 alrichardbollans