Questions tagged [matplotlib-basemap]

The matplotlib basemap toolkit is a library for plotting 2D data on maps in Python. It is similar in functionality to the matlab mapping toolbox, the IDL mapping facilities, GrADS, or the Generic Mapping Tools. PyNGL and CDAT are other libraries that provide similar capabilities in Python.

Homepage: http://matplotlib.github.com/basemap/

Basemap does not do any plotting on its own, but provides the facilities to transform coordinates to one of 25 different map projections (using the PROJ4 C library). Matplotlib is then used to plot contours, images, vectors, lines or points in the transformed coordinates. Shoreline, river and political boundary datasets (from Generic Mapping Tools) are provided, along with methods for plotting them. The GEOS library is used internally to clip the coastline and political boundary features to the desired map projection region.

Basemap provides facilities for reading shape files.

Basemap is geared toward the needs of earth scientists, particularly oceanographers and meteorologists. The author originally wrote Basemap to help in his research (climate and weather forecasting), since at the time CDAT was the only other tool in python for plotting data on map projections. Over the years, the capabilities of Basemap have evolved as scientists in other disciplines (such as biology, geology and geophysics) requested and contributed new features.

Deprecation Notice: As seen at the home page, "Basemap is deprecated in favor of the Cartopy project." See here for more information.

1245 questions
51
votes
7 answers

why does my colorbar have lines in it?

Edit: Since this seems to be a popular post, here's the solution that seems to be working well for me. Thanks @gazzar and @mfra. cbar.solids.set_rasterized(True) cbar.solids.set_edgecolor("face") Does anyone know why my colorbar has what appear to…
jseabold
  • 7,903
  • 2
  • 39
  • 53
47
votes
18 answers

Python basemap module impossible to import

I have troubles to import the basemap module of mpl_toolkits in python. Here is what I get when I run the test.py script from the module directory: /usr/lib/python2.7/dist-packages/mpl_toolkits/basemap$ python test.py Traceback (most recent call…
Arnaud BUBBLE
  • 677
  • 1
  • 6
  • 10
33
votes
10 answers

Basemap import error in PyCharm — KeyError: 'PROJ_LIB'

I tried to use Basemap package to plot a map by PyCharm, but I got something wrong with from mpl_toolkits.basemap import Basemap` And the Traceback as followed: Traceback (most recent call last): File…
Yupei
  • 411
  • 1
  • 5
  • 9
31
votes
5 answers

Is it possible to control matplotlib marker orientation?

If I have a triangular marker, is it possible to control its orientation? I have a series of facets, with their corresponding vertices, and I would like to plot a basemap of them. I know it is straightforward script when using Mayavi and…
phasselmann
  • 465
  • 2
  • 6
  • 17
28
votes
6 answers

Basemap with Python 3.5 Anaconda on Windows

I use Python 3.5 with latest version of Anaconda on Windows (64 bit). I wanted to install Basemap using conda install basemap. Apparently there is a conflict between Python 3 and basemap. After some googling indeed I found that basemap is not…
Prikers
  • 858
  • 1
  • 9
  • 24
27
votes
6 answers

OSError geos_c could not be found when Installing Shapely

I'm a newbie to making/plotting on maps with python, been trying to follow this blogpost to generate a world map ( http://sciblogs.co.nz/seeing-data/2011/08/12/plotting-geographic-data-on-a-world-map-with-python/ ). Got stuck with a few things…
msunbot
  • 1,871
  • 4
  • 16
  • 16
27
votes
2 answers

Python Matplotlib Basemap overlay small image on map plot

I am plotting data from an aircraft on a map and I would like to insert this 75px by 29px PNG image of an airplane at the coordinates of the latest data point on the plot. As far as I know and have read, pyplot.imshow() is the best way to…
Levi Cowan
  • 789
  • 2
  • 9
  • 13
26
votes
2 answers

Draw polygons more efficiently with matplotlib

I have a dateset of around 60000 shapes (with lat/lon coordinates of each corner) which I want to draw on a map using matplotlib and basemap. This is the way I am doing it at the moment: for ii in range(len(data)): lons =…
HyperCube
  • 3,870
  • 9
  • 41
  • 53
24
votes
6 answers

Installing basemap on Mac / Python

I'm having trouble to get the basemap to work in Python in my Mac. I keep receiving: from mpl_toolkits.basemap import basemap ImportError: No module named basemap What I did: brew install gdal brew install gets export…
pceccon
  • 9,379
  • 26
  • 82
  • 158
24
votes
1 answer

How to smooth by interpolation when using pcolormesh?

I have a basemap of the world, and it's filled with data (lintrends_mean) using pcolormesh. Because the data has relatively large grid boxes, I'd like to smooth the plot. However, I can't figure out how to do this. Setting shading='gouraud' in the…
Cebbie
  • 1,741
  • 6
  • 23
  • 37
24
votes
3 answers

Fill countries in python basemap

Hi I am trying to plot a map using pythons basemap with some countries filled in a certain colour. Is there a quick and easy solution out there??
red_tiger
  • 1,402
  • 3
  • 16
  • 32
23
votes
1 answer

How to set the label Fonts as "Time New Roman" by drawparallels in python

I have draw a map with latitudes labelled but I want to set the fonts as "Times New Roman". How to make it possible? m.drawparallels(parallels,labels=[1,0,0,0],fontsize=12)
Wang Tao
  • 233
  • 1
  • 2
  • 6
23
votes
2 answers

How to insert scale bar in a map in matplotlib

Any ideas on how can I insert a scale bar in a map in matplotlib that shows the length scale? something like the one I have attached. Or maybe any ideas on measuring and showing distances automatically (not drawing an arrow and writing the distance…
Behnam
  • 501
  • 1
  • 5
  • 21
20
votes
2 answers

What names can be used in plt.cm.get_cmap?

I have this code : plt.scatter(data_projected[:,0],data_projected[:,1],c=digits.target ,edgecolors='none',alpha=0.5,cmap=plt.cm.get_cmap('nipy_spectral',10)); My confusion comes from plt.cm.get_cmap('nipy_spectral',10). Sometimes there…
Timi
  • 892
  • 1
  • 8
  • 17
20
votes
7 answers

world map without rivers with matplotlib / Basemap?

Would there be a way to plot the borders of the continents with Basemap (or without Basemap, if there is some other way), without those annoying rivers coming along? Especially that piece of Kongo River, not even reaching the ocean, is…
Sampo Smolander
  • 1,605
  • 2
  • 15
  • 33
1
2 3
82 83