Questions tagged [cartopy]

Cartopy is a Python package harnessing the power of matplotlib to deliver informative, precise and striking maps.

Cartopy is a Python package designed to make drawing maps for data analysis easy and enjoyable.

Primarily the non-drawing functionality of cartopy makes use of proj.4, numpy, geos and shapely; with simple and intuitive interfacing to matplotlib for map drawing.

Some of the key features of cartopy are:

  • object oriented projection definitions
  • point, line, polygon and image transformations between projections
  • integration to expose advanced mapping in matplotlib with a simple and intuitive interface
  • work-in-progress mechanisms for accessing specialist data such as those from the “Shuttle - Radar Topography Mission” (SRTM) and the “Global Self-consistent, Hierarchical, High-resolution Shoreline” database (GSHHS).

Licensed under the GNU LGPL3, cartopy's latest documentation can be found at http://scitools.org.uk/cartopy/docs/latest and the source repository at https://github.com/SciTools/cartopy

909 questions
76
votes
4 answers

How do I change matplotlib's subplot projection of an existing axis?

I'm trying to construct a simple function that takes a subplot instance (matplotlib.axes._subplots.AxesSubplot) and transforms its projection to another projection, for example, to one of the cartopy.crs.CRS projections. The idea looks something…
Denis Sergeev
  • 1,052
  • 1
  • 8
  • 19
35
votes
7 answers

Using pip install to install Cartopy but missing Proj version at least 4.9.0

It seems that I cannot get pip to install Cartopy on my computer. I work straight from the windows command line (no Anaconda or other proxy programs). When I try "pip install cartopy" I get the expected: C:\Users\Justin\Documents\Python…
Justin Jones
  • 361
  • 1
  • 3
  • 7
28
votes
6 answers

How can I show a km ruler on a cartopy / matplotlib plot?

How can I show a km ruler for a zoomed in section of a map, either inset in the image or as rulers on the side of the plot? E.g. something like the 50 km bar on the side (left) or the inset in mi (right): (sources: 1, 2) (issue: cartopy#490)
gauteh
  • 16,435
  • 4
  • 30
  • 34
27
votes
3 answers

Correct placement of colorbar relative to geo axes (cartopy)

Using Cartopy, I would like to have full control of where my colorbar goes. Usually I do this by getting the current axes position as basis and then create new axes for the colorbar. This works well for standard matplotlib axes but not when using…
yngwaz
  • 769
  • 1
  • 9
  • 17
21
votes
3 answers

MatplotLib 'saveFig()' Fullscreen

I used MatplotLib with Cartopy to generate some data images. The problem is that when I set the frame size to fullscreen and use plt.show() the image is perfect and the resolution is fine. However, when I save this figure using 'plt.savefig()' the…
Hollweg
  • 213
  • 1
  • 3
  • 8
19
votes
2 answers

Setting up a map which crosses the dateline in cartopy

I received the following email and wanted to make sure the answer to this question was available to everybody: Hi, I would like to setup a simple latitude longitude map, using cartopy, which crosses the dateline and shows east Asia on the left hand…
pelson
  • 21,252
  • 4
  • 92
  • 99
15
votes
2 answers

Making proj_api.h available for pip install cartopy

I am trying to install cartopy via pip install cartopy. I have installed proj.4 and it has placed a necessary file here ~/Downloads/proj-4.9.2 $ ls -l /usr/local/include/proj_api.h -rw-r--r--@ 1 dom admin 5911 Nov 21 11:06…
idontgetoutmuch
  • 1,621
  • 11
  • 17
15
votes
1 answer

Why the annotate worked unexpected here in cartopy?

Code first: import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projection=ccrs.Mercator()) ax.set_extent([72, 135, 18, 53]) ax.annotate('hello', xy=(100, 49), xycoords='data', transform=ccrs.PlateCarree(),…
gepcel
  • 1,326
  • 11
  • 21
14
votes
1 answer

Geometry must be a Point or LineString error using Cartopy

I'm trying to run a simple Cartopy example: import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() plt.show() But I'm getting this error: Geometry must be a Point or…
Marc
  • 1,340
  • 2
  • 14
  • 23
14
votes
1 answer

Cartopy examples produce a Segmentation fault

Cartopy can't draw virtually anything. Even a simple example results in a segfault. Segmentation fault is all Python 3.7.0 says before crashing. So does Python 3.6.6. The faulty line appear to be ax.coastlines(). ax.gridlines() gives the same silent…
StSav012
  • 776
  • 5
  • 15
14
votes
2 answers

cartopy - set_extent() extending requested boundary

i'm new to cartopy and still learning basic features. I tried to plot a specific region however, cartopy extended this region and produced a map going up to approximately 85oN when I requested 80oN. Is there a way I can ensure I only get the region…
Ray Bell
  • 1,508
  • 4
  • 18
  • 45
13
votes
1 answer

Cartopy: order of rendering layers with scatter data

I am trying to plot position of several points (scatter plot) on a map using Cartopy (see code below). When I try to render the plot, data-points are rendered behind LAND-layer. But I want to plot my scatter-data over LAND-layer... What I am doing…
bubble
  • 1,634
  • 12
  • 17
13
votes
2 answers

Draw a map of a specific country with cartopy?

I have tried this example from the Cartopy gallery, which works fine. But how do I focus on another country, i.e. show only Germany? I've tried some coordinates on the extend() method, but I didn't manage to get to look it like the US map. Or do I…
jackson
  • 386
  • 1
  • 4
  • 21
10
votes
1 answer

County boarders in Cartopy

How do you plot US county borders in Cartopy? It's very straight forward to plot state and country boundaries ax.add_feature(cfeature.BORDERS.with_scale('50m')) ax.add_feature(cfeature.STATES.with_scale('50m')) But I can't seem to find a similar…
blaylockbk
  • 2,503
  • 2
  • 28
  • 43
10
votes
2 answers

Why do my google tiles look poor in a Cartopy map?

I am a bit puzzled by the rendering of google tiles with Cartopy. The map looks extremely poor compared to the standard google map look. Example (code from https://ocefpaf.github.io/python4oceanographers/blog/2015/06/22/osm/): import…
stm4tt
  • 755
  • 1
  • 5
  • 22
1
2 3
60 61