Непонятно, почему ваша команда rcParams['legend.loc'] = "best"
не влияет на следующие цифры.Как видите, он работает, как и ожидалось, в следующем коде:
import numpy as np
from matplotlib import pyplot as plt
#possible legend locations
leg_loc = {0: "best",
1: "upper right",
2: "upper left",
3: "lower left",
4: "lower right",
5: "right",
6: "center left",
7: "center right",
8: "lower center",
9: "upper center",
10: "center"}
#random legend location
loc_num = np.random.randint(10)
#set it for all following figures
plt.rcParams['legend.loc'] = leg_loc[loc_num]
#create three figures with random data
n = 10
xdata = np.arange(n)
for i in range(3):
plt.figure(i)
ydata = np.random.random(n)
#set some points in right upper corner, in case legend location is "best"
if i == 1:
ydata[-3:] = 0.98
plt.scatter(xdata, ydata, label = "data #{}\nlegend location: {}".format(i, leg_loc[loc_num]))
plt.legend()
plt.show()