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
19
votes
3 answers

How to use Basemap (Python) to plot US with 50 states?

I am aware that the powerful package Basemap can be utilized to plot US map with state boundaries. I have adapted this example from Basemap GitHub repository to plot 48 states colored by their respective population density: Now my question is: Is…
MomoPP
  • 599
  • 2
  • 6
  • 14
17
votes
1 answer

Plot GDAL raster using matplotlib Basemap

I would like to plot a raster tiff (download-723Kb) using matplotlib Basemap. My raster's projection coordinates is in meter: In [2]: path = r'albers_5km.tif' raster = gdal.Open(path, gdal.GA_ReadOnly) array =…
Mattijn
  • 12,975
  • 15
  • 45
  • 68
16
votes
3 answers

draw grid lines over an image in matplotlib

How can I draw regular grid lines over a tiff image? I want to draw regular square grids for each interval (say 100 by 100 pixels) over the image and save that with the drawings. I also need to overlay each grid id as '1','2',...at the middle of…
2964502
  • 4,301
  • 12
  • 35
  • 55
16
votes
2 answers

Drawing a graph with NetworkX on a Basemap

I want to plot a graph on a map where the nodes would be defined by coordinates (lat, long) and have some value associated. I have been able to plot points as a scatterplot on a basemap but can't seem to find how to plot a graph on the map. Thanks.…
Nitin
  • 2,624
  • 7
  • 29
  • 43
16
votes
2 answers

How to Install Matplotlib Basemap Module on Windows 7 with WinPython (or any Python stack install)?

I've found that the Basemap (module for matplotlib and Python) binary installer for Windows cannot detect Python on the system when Python is installed as part of a stack install, like Anaconda or WinPython. The installer exits, rather than allow…
r4gt4g
  • 304
  • 1
  • 2
  • 11
16
votes
3 answers

Eliminate white edges in Matplotlib/Basemap pcolor plot

I am plotting data on a map using this code: import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.cm as cm from mpl_toolkits.basemap import Basemap from matplotlib.patches import Polygon from scipy.io import…
HyperCube
  • 3,870
  • 9
  • 41
  • 53
15
votes
3 answers

How to make grouper and axis the same length?

For my assignment I'm supposed to plot the tracks of 20 hurricanes on a map using matplotlib. However when I run my code I get the error: AssertionError:Grouper and axis must be the same length Here's the code I have: import numpy as np from…
mikez1
  • 685
  • 4
  • 9
  • 15
15
votes
3 answers

How to draw rectangles on a Basemap

I'm looking for a way to plot filled rectangles on a Basemap. I could easily draw the rectangle's edges using the drawgreatcircle method, but I cannot find a way to actually fill these rectangles (specifying color and alpha).
andreas-h
  • 10,679
  • 18
  • 60
  • 78
14
votes
5 answers

Basemap library using Anaconda Jupyter Notebooks - KeyError: PROJ_LIB

I'm trying to install and import the Basemap library into my Jupyter Notebook, but this returns the following error: KeyError: 'PROJ_LIB' After some research online, I understand I'm to install Basemap on a separate environment in Anaconda. After…
RubenB
  • 141
  • 1
  • 1
  • 4
14
votes
2 answers

color matplotlib map using bicubic interpolation

I know that matplotlib and scipy can do bicubic…
tommy.carstensen
  • 8,962
  • 15
  • 65
  • 108
14
votes
3 answers

Why do I get "UserWarning: Module dap was already imported from None ..."

I have python-matplotlib and python-mpltoolkits.basemap installed from Ubuntu packages. Installing python-mpltoolkits.basemap also installs python-dap as a dependency. When I import basemap, I get this warning: >>> import…
Sampo Smolander
  • 1,605
  • 2
  • 15
  • 33
13
votes
4 answers

How to install Matplotlib's basemap?

It is unclear to me how to install Matplotlib's Basemap on Windows. Maybe the question is straightforward, I need some help. I followed this tutorial. As far as I understand, first, GEOS and PROJ4 should be installed, and lastly…
Klausos Klausos
  • 15,308
  • 51
  • 135
  • 217
13
votes
4 answers

Python Basemap Import error: "requirement already satisfied"

What works is import mpl_toolkits What not works is (Import Error basemap not found) from mpl_toolkits.basemap import Basemap I followed the instructions here : http://matplotlib.org/basemap/users/installing.html Downloaded the lastest…
peter
  • 315
  • 1
  • 3
  • 11
12
votes
2 answers

How can I install Basemap in Python 3 / Matplotlib 2 on Ubuntu 16.04?

I tried pip3 install basemap but Basemap seems not to be on PyPI. There is an old question but it has no answer. What I did I downloaded basemap 1.07 (source) Matplotlib 2, numpy 1.11, PIL, python3-dev is installed I'm not sure where / how to get…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
12
votes
5 answers

How to use OpenStreetMap background on Matplotlib Basemap

This should be simple, but when I look for it I just find web packages. I need something better than as oriented on This Blog. Maybe using .oms file or shapefiles. Some way to give bbox and get the OpenStreetMap background on Basemap map. I found…
iury simoes-sousa
  • 1,440
  • 3
  • 20
  • 37
1
2
3
82 83