首页 > 解决方案 > 在 Python 中将子图连接成一个图

问题描述

所以我有当前函数,它给了我一个圆圈和一个点在给定圆圈中心的图:

def epicentral_distance(station, differential_time_variable, Vp = 5.5, Vs = 3.2):
    ri = differential_time_variable*(1/Vs - 1/Vp)**(-1)
    print( np.round(ri,3) )
    return np.round(ri,3)


def station_earthquake_GraphFunction(station,differential_time_variable, Vp = 5.5, Vs = 3.2):
    radius = epicentral_distance(station, differential_time_variable, Vp = 5.5, Vs = 3.2)
    fig, ax = plt.subplots(figsize = (5,5))

    graph_station = plt.plot(station[0],station[1],'^r')
    graph_circle = plt.Circle(station, radius, color = 'r',fill = False)

    ax.add_artist(graph_circle)
    plt.xticks(np.arange(-100,100,20))
    plt.yticks(np.arange(-100,100,20))
    return graph_station, graph_circle

我正在尝试使用这些值运行该函数:

station_earthquake_GraphFunction((10,10), 3.922)
station_earthquake_GraphFunction((15,45),3.272)
station_earthquake_GraphFunction((60,30),3.874)

这里有两个问题:

  1. 每次运行该函数时,我都会得到一个单独的图。我想运行该函数几次并将结果绘制在一个图表上。我该怎么做?

  2. 运行此函数 3 次后,我将有 3 个圆在给定点相交。如何确定交点的 x 和 y 值?

标签: pythonpython-3.xnumpymatplotlib

解决方案


推荐阅读