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
7
votes
0 answers

How to speed up a Python Basemap choropleth animation

Taking ideas from various sources, and combining with my own, I sought to create an animated maps showing the shading of countries based on some value in my data. The basic process is this: Run DB query to get dataset, keyed by country and time Use…
Bat Masterson
  • 1,164
  • 3
  • 11
  • 27
7
votes
2 answers

How to remove/omit smaller contour lines using matplotlib

I am trying to plot contour lines of pressure level. I am using a netCDF file which contain the higher resolution data (ranges from 3 km to 27 km). Due to higher resolution data set, I get lot of pressure values which are not required to be plotted…
sundar_ima
  • 3,604
  • 8
  • 33
  • 52
7
votes
1 answer

Country labels on Basemap

I would like to plot a trajectory on a Basemap, and have country labels (names) shown as an overlay. Here is the current code and the map it produces: import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.basemap import…
Hezi Resheff
  • 947
  • 7
  • 7
7
votes
1 answer

Mask area outside of imported shapefile (basemap/matplotlib)

I'm plotting data on a basemap of the eastern seaboard of the U. S. and Canada through Matplotlib. In addition to the base layer (a filled contour plot), I overlayed a shapefile of this focus region atop the data using Matplotlib's readshapefile…
user2607622
  • 113
  • 1
  • 4
7
votes
2 answers

contour plot - clabel spacing

I have trouble with matplotlib / pyplot / basemap. I plot contour lines (air pressure) on a map. I use clabel to show the value of the contour lines. But the problem is: the padding between the value and the contour line is too much. I have found…
mcatis
  • 1,176
  • 4
  • 11
  • 24
7
votes
1 answer

3D CartoPy similar to Matplotlib-Basemap

I'm new to Python with a question about Cartopy being able to be used in a 3D plot. Below is an example using matplotlibBasemap. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.basemap import Basemap m =…
7
votes
1 answer

Cartesian projection issue in a FITS image through PyFITS / AstroPy

I've looked and looked for a solution to this problem and am turning up nothing. I'm generating rectangular FITS images through matplotlib and subsequently applying WCS coordinates to them using AstroPy (or PyFITS). My images are in galactic…
Teachey
  • 549
  • 7
  • 18
7
votes
3 answers

Problems installing/importing Basemap

I have installed Anaconda (version 1.6.2) installed on my 64 bit machine. It comes with a great set of libraries, but I also need Basemap, part of matlibplot, but it is not included with the Anaconda install. I attempted to install Basemap and move…
jrb0042
  • 71
  • 1
  • 1
  • 2
7
votes
1 answer

Matplotlib basemap: Popup box

I want to know how to create a popup box in a basemap plot. When I hover my mouse over a location , it should trigger the popup box. Is this possible?
Andy Stow Away
  • 649
  • 1
  • 8
  • 17
6
votes
2 answers

Python,IndexError: arrays used as indices must be of integer (or boolean) type

Iam getting an IndexError: arrays used as indices must be of integer (or boolean) type at the line for pcolormesh, any idea how to handle this. script: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import…
Bachi
  • 133
  • 1
  • 2
  • 6
6
votes
1 answer

Plot_confusioin_matrix plot is not showing integer value instead it is showing some exponential value

from sklearn.metrics import confusion_matrix from sklearn.metrics import plot_confusion_matrix print('*** Test Accuracy ***',forest.score(X_test,y_test)) disp = plot_confusion_matrix(forest, X_test, y_test, …
6
votes
2 answers

Strange lines appear on pcolormesh in basemap when using a nonzero alpha value

When plotting data using pcolormesh on a basemap projection (or a cartopy projection) I notice strange lines appear when I set the alpha value to less than 1. Example code: from mpl_toolkits.basemap import Basemap import numpy as np import…
ricitron
  • 151
  • 1
  • 9
6
votes
1 answer

Not able to add 'map.drawcoastline' to 3d figure using 'ax.add_collection3d(map.drawcoastlines())'

So I want to plot a 3d map using matplotlib basemap. But an error message comes popping up. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.basemap import Basemap from matplotlib.collections import…
6
votes
1 answer

How can i plot a map using Latitude and longitude data in python & Highlight few Latitude and Longitude points in the map ?ints

I am new in working with python. I have a question regarding How to plot a map in Python using Latitude and Longitude data ? What i have done before : Step 1 : I have a CSV file which contains Information about Vehicle Driving signal. Step 2 : From…
Mari
  • 698
  • 1
  • 8
  • 27
6
votes
1 answer

Aligning maps made using basemap

Is there a way to align python basemaps like this figure below? Here's some sample basemap code to produce a map: from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt fig = plt.figure(figsize=(8,…
user308827
  • 21,227
  • 87
  • 254
  • 417