0

我有这个for循环,它将焦点机制​​作为一个数字射出,我希望能够单独保存每个数字,但不知道如何。

for strike,dip,rake in zip(out_df.strike,out_df.dip,out_df.rake):
     fig, ax = mplstereonet.subplots(figsize=(8,8))
     plt.rcParams["axes.labelsize"]=14
     bball = beachball.beach([strike, dip, rake]
          , width=433            # scale of the beachball in the (x,y) plane
          , linewidth=1             # thickness of nodal planes and beachball edge lines
          , facecolor='darkblue'    # color of one of the axes
          , zorder=1 # make sure beachball plots on top
          , axes = ax)
     ax.add_collection(bball)
4

1 回答 1

0

像下面的代码应该做你想做的事:

m = 0
for strike,dip,rake in zip(out_df.strike,out_df.dip,out_df.rake):
     m += 1
     fig, ax = mplstereonet.subplots(figsize=(8,8))
     plt.rcParams["axes.labelsize"]=14
     bball = beachball.beach([strike, dip, rake]
          , width=433            # scale of the beachball in the (x,y) plane
          , linewidth=1             # thickness of nodal planes and beachball edge lines
          , facecolor='darkblue'    # color of one of the axes
          , zorder=1 # make sure beachball plots on top
          , axes = ax)
     ax.add_collection(bball)
     plt.savefig(f"figure_{m}.png")
     plt.close()
于 2021-12-20T03:18:58.683 回答