cartopy

How to update projection of GeoAxes using Cartopy?

自古美人都是妖i 提交于 2020-04-17 21:11:26
问题 I'm trying to make a somewhat interactive map plot with matplotlib utilizing a button added to the toolbar in Matplotlib's navigation Toolbar. The objective: The objective that I'm trying to achieve is to be able to change the axes projection on the fly without creating a new axes. There are many methods in the axes object that gets created by Matplotlib to change other aspects of the plot, but I want to be able to change projection from say, PlateCarree to NorthPolarStereo and vice versa.

cartopy: higher resolution for great circle distance line

£可爱£侵袭症+ 提交于 2020-04-12 16:59:09
问题 I am trying to plot a great circle distance between two points. I have found an in the cartopy docs (introductory_examples/01.great_circle.html): import matplotlib.pyplot as plt import cartopy.crs as ccrs ax = plt.axes(projection=ccrs.Robinson()) ax.set_global() ax.coastlines() plt.plot([-0.08, 132], [51.53, 43.17], color='red', transform=ccrs.Geodetic()) plt.plot([-0.08, 132], [51.53, 43.17], color='blue', transform=ccrs.PlateCarree()) plt.show() which makes the following image: great circle

Drawing Circles with cartopy in orthographic projection

被刻印的时光 ゝ 提交于 2020-01-14 20:43:49
问题 I am trying to draw circles at a given geographical coordinate with a certain radius using cartopy. I want to draw using an orthographic projection, which is centred at the centre of the circle. I use the following python code for testing: import numpy as np import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import matplotlib.patches as mpatches # example: draw circle with 45 degree radius around the North pole lon = 0 lat = 90 r = 45 # find map

Drawing Circles with cartopy in orthographic projection

夙愿已清 提交于 2020-01-14 20:43:30
问题 I am trying to draw circles at a given geographical coordinate with a certain radius using cartopy. I want to draw using an orthographic projection, which is centred at the centre of the circle. I use the following python code for testing: import numpy as np import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import matplotlib.patches as mpatches # example: draw circle with 45 degree radius around the North pole lon = 0 lat = 90 r = 45 # find map

Obtaining coordinates in projected map using Cartopy

老子叫甜甜 提交于 2020-01-13 20:20:11
问题 I'm trying to obtain the coordinates of the features of a map using Cartopy but I would like to obtain the map projected coordinates instead of the data from the original projection. For instance: import matplotlib.pyplot as plt import cartopy.crs as ccrs fig = plt.figure(figsize=(10, 10)) ax = plt.axes(projection=ccrs.epsg(3857)) fig.add_axes(ax) ax.coastlines() ax.set_global() lines = ax.plot((0, 360), (-85.06, 85.06), transform=ccrs.PlateCarree()) fig.show() The previous code shows a map

An simple interface plotted by matplotlib and cartopy isn't showed in wxpython

这一生的挚爱 提交于 2020-01-05 05:46:07
问题 I'm completely a newcomer in wxpython.The following codes show a simple plot: #-*-coding:utf-8-*- import matplotlib.pyplot as plt import matplotlib.ticker as mticker import cartopy.crs as ccrs from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER from matplotlib.offsetbox import AnnotationBbox,OffsetImage from PIL import Image fig=plt.figure(figsize=(20,10)) ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() ax.stock_img() gl = ax.gridlines(crs=ccrs.PlateCarree()

Polygon containment test in matplotlib artist

情到浓时终转凉″ 提交于 2020-01-01 06:57:47
问题 I have the following code, gathered initially from here., which uses matplotlib, shapely, cartopy to draw a world map. When a click is made, I need to determine on which country it was made. I am able to add a pick_event callback to the canvas, however, it is called on every artist.(cartopy.mpl.feature_artist.FeatureArtist, which corresponds to a country). Given an artist and a mouse event with x, y coordinates, how can I determine containment? I've tried artist.get_clip_box().contains , but

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

六眼飞鱼酱① 提交于 2020-01-01 01:09:39
问题 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 like this import cartopy.crs as ccrs import matplotlib.pyplot as plt def make_ax_map(ax, projection=ccrs.PlateCarree()): # set ax projection to the specified projection ... # other fancy formatting ax2.coastlines() ... # Create a grid of plots fig,

Draw a map of a specific country with cartopy?

时间秒杀一切 提交于 2019-12-29 04:23:26
问题 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 extend() method, but I didn't manage to get to look it like the US map. Or do I have to modify the shape file? 回答1: Using the Global Administrative Areas dataset at http://www.gadm.org/country, just download the Germany dataset and use cartopy's

Draw a map of a specific country with cartopy?

北慕城南 提交于 2019-12-29 04:23:06
问题 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 extend() method, but I didn't manage to get to look it like the US map. Or do I have to modify the shape file? 回答1: Using the Global Administrative Areas dataset at http://www.gadm.org/country, just download the Germany dataset and use cartopy's