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

612 questions
51
votes
3 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
  • 780
  • 1
  • 6
  • 17
21
votes
2 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
  • 579
  • 5
  • 15
19
votes
4 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
  • 201
  • 1
  • 2
  • 7
19
votes
5 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
  • 14,017
  • 3
  • 25
  • 32
17
votes
2 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
  • 173
  • 1
  • 1
  • 8
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,613
  • 11
  • 17
15
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
  • 18,423
  • 3
  • 80
  • 88
11
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,426
  • 11
  • 16
11
votes
2 answers

Draw a map of a specific country with cartopy?

I have tried this example here, which works fine. But how do I focus on another country, i.e. show only germany? source for this example http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html I've tried some coordinates on the…
jackson
  • 316
  • 1
  • 2
  • 17
10
votes
1 answer

Location of stored offline data for cartopy

Where is offline data stored in cartopy? Is it stored in the data folder under site-packages? Is there any way to trigger the downloading of all available data? I would like to copy this over to a Linux machine that is not connected to the internet.…
Dan Tyndall
  • 121
  • 1
  • 6
9
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
  • 345
  • 3
  • 10
9
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
  • 665
  • 5
  • 21
9
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,024
  • 7
  • 16
8
votes
1 answer

How to put a label on a country with Python cartopy?

Using python3 and cartopy, having this code: import matplotlib.pyplot as plt import cartopy import cartopy.io.shapereader as shpreader import cartopy.crs as ccrs ax =…
Vityata
  • 39,812
  • 7
  • 40
  • 77
8
votes
1 answer

Use Google map tiles in Cartopy

It seems fetching Google tiles directly isn't supported very well by Google via normal API access (even with an API key). Hence, cartopy.io.img_tiles.GoogleTiles doesn't work well as it is able to fetch tiles only for one or two trials after which…
virtualmic
  • 2,774
  • 6
  • 23
  • 33
1
2 3
40 41