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
12
votes
5 answers

Plot only on continent in matplotlib

I am drawing a map using basemap from matplotlib. The data are spreaded all over the world, but I just want to retain all the data on the continent and drop those on the ocean. Is there a way that I can filter the data, or is there a way to draw the…
ZYX
  • 794
  • 1
  • 8
  • 12
11
votes
8 answers

Importing mpl_toolkits.basemap on Windows?

I have recently started using Python 3.5 and Anaconda on my Windows pc. I am trying to plot a map. However, When I am in my Jupyter notebook and i type the command import mpl_toolkits.basemap I get an error message saying 'no module name'…
11
votes
2 answers

Matplotlib: draw a selection area in the shape of a rectangle with the mouse

I want to be able to draw a selection area on a matplotlib plot with a mouse event. I didn't find information on how to do it with python. In the end, I want to be able to draw a region of interest with my mouse on a map created with matplotlib…
leroygr
  • 2,349
  • 4
  • 18
  • 18
10
votes
1 answer

How to plot 3D Earth in Python?

I'm trying to plot a satellite orbit around the Earth. This is what I currrently have: I made this plot using the Axes3D function in mpl_toolkits.mplot3d. Ideally what I would like to do, is to replace the simple sphere with an actual Earth with…
MichaelDeSanta
  • 143
  • 1
  • 7
9
votes
4 answers

Maplotlib and Basemap: cannot import name 'dedent'

I'm trying to draw a network on a basemap overlay. I have packages: basemap=1.3.0=py36ha7665c8_0 matplotlib=3.3.1=0 matplotlib-base=3.3.1=py36hba9282a_0 networkx=2.5=py_0 When I run only the line from mpl_toolkits.basemap import Basemap I get …
Jorrit G
  • 509
  • 2
  • 5
  • 6
9
votes
2 answers

How can I get my contour plot superimposed on a basemap

This is a question I asked several months ago and am still struggling to come to a solution. My code gives me a basemap and a contour plot side by side (but printing to file only gives the contour plot), but I want them superimposed. The best…
Zilore Mumba
  • 1,346
  • 4
  • 23
  • 33
9
votes
1 answer

using scalebar in matplotlib basemap

from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np m = Basemap(projection='cyl',resolution='c',area_thresh=10,llcrnrlon=-180,urcrnrlon=180,\ llcrnrlat=-90,urcrnrlat=90) m.etopo() Actually, I did not…
2964502
  • 4,301
  • 12
  • 35
  • 55
8
votes
3 answers

Python basemap stereographic map

I want to display some values on a stereographic map (in this case southpole (spstere)). If I display them on a cylindric map (cyl) everything is fine: m =…
red_tiger
  • 1,402
  • 3
  • 16
  • 32
8
votes
1 answer

Installation Error: installing basemap on windows

I'm trying to install basemap, and it seems worked fine using, conda install -c conda-forge basemap in anaconda prompt. However when I entered this code on my jupyternotebook, import matplotlib.pyplot as plt from mpl_toolkits.basemap import…
Ella
  • 93
  • 6
8
votes
2 answers

Add transparent picture over plot

My python script below adds a picture (a generated rectangle on this simple example) and GPS track on a map generated with Basemap module. Now I would like to make both track an rectangle transparent. No problem for the track via alpha kwarg but I…
samy
  • 113
  • 1
  • 7
8
votes
1 answer

Using Python to plot Natural Earth shapes as polygons in Matplotlib Basemap

I'm close to getting the map that I want. Matplotlib's Basemap is great, but the coastlines are too coarse when I zoom in. I can read the Natural Earth shapefiles and plot them, which are much better... but when I try and fill the polygons, I think…
Noise in the street
  • 589
  • 1
  • 6
  • 20
8
votes
1 answer

Contour irregular data within polygon

I need to create filled contour plots of sea surface temperature (SST) data within a polygon, however I am not sure the best way to do this. I have three 1D arrays containing data for X, Y, and SST which I plot using the following to create the…
Trond Kristiansen
  • 2,379
  • 23
  • 48
8
votes
2 answers

Python GUI from Java

I am working on a program which takes a user input and generates an output as a map projection plot. The easiest map projection library that I have found is matplotlib-basemap, written in python a language I am not much familier with (I work on Java…
javaEd
  • 158
  • 2
  • 10
7
votes
1 answer

AttributeError: module 'pyproj' has no attribute 'pyproj_datadir'

Have had a nightmare downloading basemap, have had so many errors and fixing them, but yet another shows up. I now keep getting the following error: Using spyder I write: from mpl_toolkits.basemap import Basemap And it outputs: File…
James Lloyd
  • 319
  • 3
  • 14
7
votes
1 answer

How to animate matplotlib's drawgreatcircle function?

I have created a small program which takes an NHL city and then draws the path the team travels throughout their season. The resulting graphic is messy: So I got the idea that it would be interesting if I animated the flight paths, sort of like…
Bryan Stafford
  • 301
  • 2
  • 12
1 2
3
82 83