我是Python的新手,我有一个关于Cartopy能否在3D绘图中使用的问题。下面是一个使用matplotlibBasemap的示例。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.basemap import Basemap
m = Basemap(projection='merc',
llcrnrlat=52.0,urcrnrlat=58.0,
llcrnrlon=19.0,urcrnrlon
我正在使用Cartopy在经度/经度网格上生成一系列绘图(从Matplotlib的底图升级),即使绘图没有引起任何错误,当我尝试使用Matplotlib的matplotlib.backends.backend_pdf.PdfPages将图形保存到多页PDF文件时,代码也会失败。 以下是代码的相关部分: import cartopy
import cartopy.crs as ccrs
from matplotlib import colorbar, cm, pyplot
from matplotlib.backends.backend_pdf import PdfPages
from mat
我有两个形状文件。一个是点特征shapefile,名为"point.shp",另一个是名为"polygon.shp“的多边形shapefile。两种我都想添加到地图上使用cartopy。我成功地添加了"polygon.shp",但是"point.shp“失败了。
这是我的密码:
import matplotlib.pyplot as plt
from cartopy import crs
from cartopy.io.shapereader import Reader
from cartopy.feature import ShapelyFea
我试图用定制的颜色绘制一个,在地图上使用cartopy和matplotlib。
import numpy as np
import matplotlib.pyplot as plt
import cartopy as cartopy
import pandas as pd
import random as rd
def getcolor(buurtnaam):
a = rd.uniform(0.0, 255.0)
b = rd.uniform(0.0, 255.0)
c = rd.uniform(0.0, 255.0)
return tuple([a, b,
我正在用Cartopy和Matplotlib绘制一些填充的等高线。数据位于纬度/经度网格上,当在cartopy投影上绘图时,一条白线沿着图形的中间延伸,或者在ccrs.PlateCarree()中将"central_longitude“设置为的任何位置 下面是一个快速设置,它显示了我正在谈论的内容。使用以下代码: import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
lon
在Python3.8.5中,使用matplotlib 3.3.2和cartopy 0.18.0,我使用以下代码在地球上绘制一个点的DataFrame: import matplotlib.pyplot as plt
import cartopy
import cartopy.io.img_tiles
import numpy as np
import pandas as pd
def plotPt(xx,clr=['red'],msize=[1.0],name=''): #plots the geo points on a globe
terrai
我在运行脚本时遇到了这个错误。有办法纠正它吗?
提前感谢
File "/usr/local/lib/python3.8/dist-packages/cartopy/mpl/geoaxes.py", line 718, in add_geometries
feature = cartopy.feature.ShapelyFeature(geoms, crs, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/cartopy/feature/__init__.py", line 221, in
我想“下载”(保存在pickle文件中)一个cartopy中加载的基本地图,这样我就可以使用与下载图像不同的脚本在matplotlib figure中的两个轴之一上重新绘制。我需要这样做,这样我就不会每次需要一个棒球手的时候都在询问斯塔门。
如何从p中提取p==<cartopy.mpl.geoaxes.GeoAxesSubplot object at 0x124210e10>中的数据
脚本1
import matplotlib.pyplot as plt
import pickle
import cartopy.feature as cfeature
from cartopy.io
我正在尝试使用Cartopy的项目NearsidePerspective,但与Matplotlib提供的真实地球图像重叠,并通过降低satellite_height参数放大了一点。似乎Cartopy无法针对此特定类型的设置正确裁切图像。图像仍然显示,而不是人们期望的地图边界。 import cartopy.crs as ccrs
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(10,10))
# Set Projection
height=3000000
#height=35785831 # this is the def
在使用Cartopy和matplotlib的pcolormesh制作地图时,我无法为缺少的值指定颜色。我希望所有的"nan“值都是灰色的,而不是白色/透明的。为此,我尝试使用matplotlib色彩映射的set_bad方法,但这似乎破坏了Cartopy。这个问题触发了Cartopy的UserWarning,但我不知道解决方法是什么。
下面是一个甚至没有NaN值的示例,但显示了问题:
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
impor