Matplotlib Tutorial 27 - Basemap customization options

preview_player
Показать описание
In this Matplotlib tutorial, we continue with the Basemap geographic plotting extension. We're going to show some of the customization options available to us.

Рекомендации по теме
Комментарии
Автор

You are a legend... and not a map legend... a gladiator legend!!! Useful tuts!

ianbrink
Автор

Thanks for the great tutorials!
And a tip for other watchers, install Pillow for the last function (bluemarble)

Ralph_-_
Автор

latitudes are the horizontal lines while longitudes are the vertical lines

sreenjaysen
Автор

line show an error of:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte
the modify that is hint isn't correct!
how i can do?

ezio
Автор

Hello,
I am using basemap to generate a plot for representing CO2 but i need to produce filled contour map of the different concentration at different locations (Lat and Long). Now for generating those maps i need to interpolate the points and this method can be done by nearest neighbour method (interpolation of co2 points). Unfortunately, python is asking me to install (natgrid) library which is so hectic to install. Can you please give me some suggestion on installing natgrid library i have already tried all options.

mannana.z.
Автор

how can I know exactly a location coordination? where could i have that infomation?

chrislam
Автор

Is there anyway to increase resolution on the bluemarble thing? (or get something else with higher resolution?)

RealMcDudu
Автор

m =Basemap(projection='mill', llcrnrlat=8, llcrnrlon=67, urcrnrlat=37, urcrnrlon=97, resolution='h')
m.drawcoastlines()
m.drawcountries(linewidth=1)
m.drawstates(color='k')
plt.title('Basic map')
plt.show()

But the states are not showing. It shows plain map. How can I show states also for india map?

ravikumargogineni
Автор

Hi, Thank you very much for the tutorial. This is AWESOME!!

I am getting this error when I add m.etopo() line. Do you have any idea why that function is not working? I am using python 3.5


File "C:\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4167, in warpimage
np.concatenate((self._bm_lons, self._bm_lons+360), 1)

IndexError: axis 1 out of bounds [0, 1)

daniz
Автор

line show an error of:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte

guess some country does not encode as utf-8?

mozarter
Автор

Hi i am getting some errors

Traceback (most recent call last):
File "p5.py", line 14, in <module>
m.etopo()
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/__init__.py", line 4017, in etopo
return self.warpimage(image='etopo', scale=scale, **kwargs)
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/__init__.py", line 4117, in warpimage
np.concatenate((self._bm_lons, self._bm_lons+360), 1)
IndexError: axis 1 out of bounds [0, 1)

thisisprabin
Автор

How to get all the country names inside a continent?

aniketmitra
Автор

After adding the m.counties [with or without a colour] I get a series of errors:
Traceback (most recent call last):
File "/Users/moneill/basemap_02.py", line 13, in <module>

File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 1980, in drawcounties
default_encoding='latin-1', drawbounds=drawbounds)
File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 2146, in readshapefile
for shprec in shf.shapeRecords():
File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 543, in shapeRecords
for rec in zip(self.shapes(), self.records())]
File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 515, in records
r = self.__record()
File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 491, in __record
value = u(value)
File "/usr/local/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 58, in u
return v.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte

Anyone else get this?

tmattoneill
Автор

Everything works fine till I try to " m.plot( xpt, ypt, 'c*', markersize=15)" plot the location of NY or LA on a map. Then I get an error "return plotfunc(self, x, y, *args, **kwargs)
File "C:\...\Python\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3285, in plot
self._restore_hold(ax)
File "C:\...\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3229, in _restore_hold
ax._hold = self._tmp_hold
AttributeError: can't set attribute" Please somebody help me to solve the problem

elmirach
Автор

Latitude are parallel to equator (horizontal) and Longitude go vertical (up to down).

Anyways tons of thanks for great tutorials.

thehornandhoof
Автор

I took a resolution of full scale, and OMG it took 5 minutes to load the map.

TXfoxie
Автор

A little trouble here..

after adding m.etopo()
this happens

Traceback (most recent call last):
File "E:\Python\Matplotlib\Basemap\test1.py", line 14, in <module>
m.etopo()
File "C:\Python34\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4061, in etopo
return self.warpimage(image='etopo', scale=scale, **kwargs)
File "C:\Python34\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4167, in warpimage
np.concatenate((self._bm_lons, self._bm_lons+360), 1)
IndexError: axis 1 out of bounds [0, 1)

shantanurahman