如何在每个象限中绘制半径变化的圆?

问题描述 投票:0回答:1

我想绘制一个类似于以下示例的形状(来自海军研究实验室TC页面)。形状由4个半径定义,每个象限一个。

sample

我在使用底图绘制的经度和纬度坐标中有多个跟踪中心:

def m_plot_wind_speeds(x,y, mps):

    # There's a switch-like statement here to determine the color of the
    # line based on wind speed which I ignored. This is passed to the 
    # color kwarg in m.plot as cur_color. 

    m.plot(x,y, '.-', markersize=ms, linewidth=lw, color=cur_color, \
 mew=1.5, markerfacecolor='k')

m = Basemap(projection='cyl',area_thresh=1000, \
    llcrnrlat=southLat,urcrnrlat=northLat,llcrnrlon=westLong,urcrnrlon=eastLong,resolution='h')
parallels = np.arange(southLat,northLat+10,10.) # make latitude lines ever 5 degrees from 30N-50N
meridians = np.arange(westLong,eastLong+30,30.) # make longitude lines every 5 degrees from 95W to 70W

m.drawparallels(parallels,labels=[1,0,0,0],labelstyle="+/-", linewidth=0, fontsize=6)
m.drawmeridians(meridians,labels=[0,0,0,1],labelstyle="+/-", linewidth=0, fontsize=6)
m.drawcountries(linewidth=0.25)

m.bluemarble()

# data is a [10]x[~]x[10] list. There are 10 trajectories, each with
# varying lengths. Each trajectory has 10 attributes.

for traj in data:
    lat = []
    lon = []
    wind_speed=[]

    for i in traj:
        lat.append(float(i[1]))
        lon.append(float(i[0]))
        wind_speed.append(float(i[2]))

   for j,var in enumerate(traj):
        if j > 0:
            x,y = m([lon[j], lon[j-1]], [lat[j], lat[j-1]])
        else:
            x,y = m([lon[j], lon[j]],[lat[j], lat[j]])
        m_plot_wind_speeds(x,y,wind_speed[j])


        # TODO: Insert a function here that takes in a 4 radii and plots them 
        # in each quadrant.

我在海军研究实验室TC页面上提供了一个示例,以显示我希望它看起来如何。我有多个跟踪中心正弦纬度和经度坐标,我知道该如何...

matplotlib geometry matplotlib-basemap cartopy metpy
1个回答
1
投票

如果您不介意向中心划线,则可以使用wedges

© www.soinside.com 2019 - 2024. All rights reserved.