• Stars
    star
    779
  • Rank 58,364 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 14 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Plot on map projections (with coastlines and political boundaries) using matplotlib

Basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib.

Requirements

Basic requirements are the following:

Optional requirements include:

  • OWSLib. It is needed for the Basemap.wmsimage function.

  • Pillow. It is needed for the methods Basemap.bluemarble, Basemap.etopo, Basemap.shadedrelief and Basemap.warpimage.

Installation

The basemap-data and basemap-data-hires packages are available in PyPI and can be installed with pip:

python -m pip install basemap-data
python -m pip install basemap-data-hires

Precompiled basemap binary wheels for Windows and GNU/Linux are also available in PyPI (architectures x86 and x64, Python 2.7 and 3.5+):

python -m pip install basemap

Otherwise, you will need to install basemap from source as follows:

  1. Install pre-requisite Python modules:

  2. Download the basemap source code and move to the packages/basemap folder:

    git clone --depth 1 https://github.com/matplotlib/basemap.git
    cd basemap/packages/basemap
  3. Build the GEOS library. You may use the helper provided in utils, i.e.

    export GEOS_DIR=<your desired location>
    python -c "import utils; utils.GeosLibrary('3.6.5').build(installdir='${GEOS_DIR}')"

    or you can link directly to the system library if it is already installed. GEOS_DIR must point to the GEOS installation prefix; e.g. if libgeos_c.so is located in /usr/lib and geos_c.h is located in /usr/include, then you must set GEOS_DIR to /usr.

  4. Build and install the basemap binary wheel:

    python -m pip install .

    On Linux, if your Python was installed through a package management system, make sure that you have the Python header Python.h required to build Cython extensions (e.g. on Debian-like systems, you should have the package python-dev installed).

  5. Check that the package installed correctly by executing:

    python -c "from mpl_toolkits.basemap import Basemap"

    You can also test the examples available in the examples folder.

License

The source code and data assets are under the following licenses:

For a full description, please visit the README and LICENSE files of each package.

Documentation

See https://matplotlib.github.io/basemap/

See scripts in examples directory for example usage.

Read the FAQ and/or email the matplotlib-users mailing list if you have problems or questions.

Contact

Ben Root [email protected]

Víctor Molina García (@molinav)

Thanks

Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Jonas Bluethgen, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions.

Known bugs

The Basemap.fillcontinents method doesn't always do the right thing. Matplotlib always tries to fill the inside of a polygon. Under certain situations, what is the inside of a coastline polygon can be ambiguous, and the outside may be filled instead of the inside. A workaround is to change the map projection region slightly or mask the land areas with the Basemap.drawlsmask method instead of filling the coastline polygons (this is illustrated in the ortho_demo.py example).

More Repositories

1

matplotlib

matplotlib: plotting with Python
Python
20,025
star
2

cheatsheets

Official Matplotlib cheat sheets
Python
7,349
star
3

mplfinance

Financial Markets Data Visualization using Matplotlib
Python
3,552
star
4

ipympl

Matplotlib Jupyter Integration
TypeScript
1,554
star
5

AnatomyOfMatplotlib

Anatomy of Matplotlib -- tutorial developed for the SciPy conference
Jupyter Notebook
1,210
star
6

mpl-finance

This package is DEPRECATED, replaced by https://github.com/matplotlib/mplfinance
Python
309
star
7

cmocean

Colormap setup for standardizing commonly-plotting oceanographic variables.
Python
230
star
8

pytest-mpl

A pytest plugin to facilitate image comparison for Matplotlib figures
Python
216
star
9

viscm

A tool for visualizing and designing colormaps using colorspacious and matplotlib
Python
165
star
10

trendvis

Python
114
star
11

mplcairo

A (new) cairo backend for Matplotlib.
C++
106
star
12

cycler

cycler: composable cycles
Python
72
star
13

mpl-third-party

Third-party Packages Webpage
Python
50
star
14

grid-strategy

Library to facilitate the arrangement of matplotlib subplots based on the number of plots
Python
41
star
15

sampledoc

CSS
41
star
16

napari-matplotlib

Linking napari layers with Matplotlib plots
Python
37
star
17

mpl-probscale

Real probability scales for matplotlib
Python
36
star
18

GettingStarted

Scipy 2019 Tutorial
Jupyter Notebook
35
star
19

matplotblog

Matplotlib blog
Jupyter Notebook
35
star
20

interactive_tutorial

Interactive Matplotlib tutorial
Python
29
star
21

matplotlib-extension-cookiecutter

A fairly opinionated cookiecutter for making a Matplotlib extension
Python
29
star
22

matplotlib.github.com

HTML
24
star
23

sample_data

Python
19
star
24

matplotview

A library for creating lightweight views of matplotlib axes.
Python
17
star
25

natgrid

C
15
star
26

mpl-altair

Matplotlib Backend for Altair Visualization Library
Python
14
star
27

mpl-gui

Prototype for mpl-gui module
Python
13
star
28

legacycontour

package for providing legacy support for contour/contourf
Python
8
star
29

mpl-brochure-binder

Notebooks for a brochure binder.
Jupyter Notebook
6
star
30

data-prototype

Python
4
star
31

CZI_2019-07_mpl

TeX
4
star
32

mpl-sphinx-theme

A thin sphinx theme to customize pydata-sphinx-theme consistently cross Matplotlib projects.
HTML
4
star
33

freetypy

Fast and modern Python wrappers for freetype, written in Python/C API
Python
4
star
34

presentations

Matplotlib talks and tutorials
Jupyter Notebook
3
star
35

mpl-docker

MPL Docker image for building docs
Dockerfile
3
star
36

mpl-brochure-site

Source for the top-level landing page.
3
star
37

devdocs

Repository for snapshots of the documentation built from the current master branch. Updated by travis
HTML
3
star
38

matplotlib-cmap-template

Template package for distributing Matplotlib colormaps.
Python
3
star
39

2020-NASA-ROSES-E7

Grant proposal responding to the 2020 NASA ROSES E7 solicitation.
TeX
3
star
40

ProjectManagement

Meeting notes and other management documentation for Matplotlib
2
star
41

governance

The governance process and model for matplotlib
Python
2
star
42

CZI_2021-03_mpl

Application for CZI EOSS round 4.
TeX
1
star
43

2024-NASA-ROSES-F7

Grant proposal responding to the 2024 NASA ROSES F7 solicitation.
TeX
1
star