[Matplotlib-users] Unable to display data using matplotlib

Andrew Dawson andrew.dawson at physics.ox.ac.uk
Fri Oct 14 07:27:19 EDT 2016


I think this is a 404 error coming from cartopy as it tries to download the
country/state/province borders. This was a known issue in cartopy, which
has been resolved in later releases. Which version of cartopy are you
using? You can check with `python -c "import cartopy;
print(cartopy.__version__)"`.

On 14 October 2016 at 12:15, ashwinD12 . <winash12 at gmail.com> wrote:

> Thanks for your response.
>
> The code as shown in that URL apparently has worked and the plot has been
> shown. I am not trying to modify the source code and as I understand the
> code it is using matplotlib and cartopy. So the question is there some
> backend matplotlib setting (such as the URL you mentioned) that needs to be
> set in order to get this to work ?
>
> My first understanding was since the error is related to  Tk and
> matplotlib there is something I am not doing right such as what is
> described here - http://matplotlib.org/examples/user_interfaces/
> embedding_in_tk2.html ?
>
> Ashwin.
>
> On Fri, Oct 14, 2016 at 4:21 PM, Joy merwin monteiro <joy.merwin at gmail.com
> > wrote:
>
>> The end of the error traceback says:
>>
>> "
>>
>> raise HTTPError(req.full_url, code, msg, hdrs, fp)
>>   urllib.error.HTTPError: HTTP Error 404: Not Found
>> "
>>
>> Looks like the code is trying to access an online resource that is not available.
>>
>> Don't think it has anything to do with matplotlib.
>>
>> Joy
>>
>>
>> On Fri, Oct 14, 2016 at 11:59 AM, ashwinD12 . <winash12 at gmail.com> wrote:
>>
>>> Hello,
>>>           I am using this example from this cookbook -
>>> http://nbviewer.jupyter.org/github/unidata/notebook-gallery/
>>> blob/master/notebooks/850mb_Temperature_Advection.ipynb
>>>
>>> and I get this exception when I run it -
>>>
>>> I am wondering whether I need to matplotlib.use('Tkagg') which I did add
>>> but does not fix the problem.
>>>
>>> File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 474, in draw
>>> self.figure.draw(self.renderer)File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
>>> draw(artist, renderer, *args, **kwargs)File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1159, in draw
>>>  func(*args)
>>>  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
>>>  draw(artist, renderer, *args, **kwargs)
>>>  File "/usr/local/lib/python3.5/dist-packages/cartopy/mpl/geoaxes.py", line 355, in draw
>>> inframe=inframe)File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
>>> draw(artist, renderer, *args, **kwargs)File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2324, in draw
>>> a.draw(renderer)File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
>>> draw(artist, renderer, *args, **kwargs)
>>>  File "/usr/local/lib/python3.5/dist-packages/cartopy/mpl/feature_artist.py", line 103, in draw
>>> geoms = self._feature.intersecting_geometries(extent)File "/usr/local/lib/python3.5/dist-packages/cartopy/feature.py", line 113, in intersecting_geometriesreturn (geom for geom in self.geometries() if
>>>  File "/usr/local/lib/python3.5/dist-packages/cartopy/feature.py", line 180, in geometries
>>> name=self.name)
>>>  File "/usr/local/lib/python3.5/dist-packages/cartopy/io/shapereader.py", line 246, in natural_earthreturn ne_downloader.path(format_dict)File "/usr/local/lib/python3.5/dist-packages/cartopy/io/__init__.py", line 223, in path
>>> result_path = self.acquire_resource(target_path, format_dict)File "/usr/local/lib/python3.5/dist-packages/cartopy/io/shapereader.py", line 301, in acquire_resource
>>> shapefile_online = self._urlopen(url)File "/usr/local/lib/python3.5/dist-packages/cartopy/io/__init__.py", line 262, in _urlopenreturn urlopen(url)File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopenreturn opener.open(url, data, timeout)File "/usr/lib/python3.5/urllib/request.py", line 472, in open
>>> response = meth(req, response)File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response'http', request, response, code, msg, hdrs)File "/usr/lib/python3.5/urllib/request.py", line 504, in error
>>> result = self._call_chain(*args)File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
>>> result = func(*args)File "/usr/lib/python3.5/urllib/request.py", line 696, in http_error_302return self.parent.open(new, timeout=req.timeout)File "/usr/lib/python3.5/urllib/request.py", line 472, in open
>>> response = meth(req, response)
>>>  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response'http', request, response, code, msg, hdrs)
>>>  File "/usr/lib/python3.5/urllib/request.py", line 510, in errorreturn self._call_chain(*args)File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
>>> result = func(*args)
>>>  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
>>>   raise HTTPError(req.full_url, code, msg, hdrs, fp)
>>>   urllib.error.HTTPError: HTTP Error 404: Not FoundTraceback (most recent call last):
>>>  File "tempAdv.py", line 72, in <module>
>>>  plt.show()
>>>  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 244, in showreturn _show(*args, **kw)
>>>  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 192, in __call__
>>>  self.mainloop()
>>>
>>>
>>>  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop
>>>
>>>  Tk.mainloop()
>>>
>>>  File "/usr/lib/python3.5/tkinter/__init__.py", line 408, in mainloop
>>> _default_root.tk.mainloop(n)
>>>
>>>  AttributeError: 'NoneType' object has no attribute 'tk
>>>
>>>
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>>
>>>
>>
>>
>> --
>> The best ruler, when he finishes his
>> tasks and completes his affairs,
>> the people say
>> “It all happened naturally”
>>
>>                                          - Te Tao Ch'ing
>>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>


-- 
Dr Andrew Dawson
Atmospheric, Oceanic & Planetary Physics
Clarendon Laboratory
Parks Road
Oxford OX1 3PU, UK
Tel: +44 (0)1865 282352
Email: andrew.dawson at physics.ox.ac.uk
Web Site: http://www2.physics.ox.ac.uk/contacts/people/dawson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20161014/930564ca/attachment-0001.html>


More information about the Matplotlib-users mailing list