问题描述
membership function 模糊算法中的隶属函数和图例的位置错误我如何更改它的位置
解决方法
对于您的图像,如果您使用 matplotlib,请使用 loc='upper center' 或 loc='best'
import numpy as np
import matplotlib.pyplot as plt
plt.plot(x,y1,label ='1')
plt.plot(x,y2,label ='2')
# Function add a legend
plt.legend(loc='upper center')
# function to show the plot
plt.show()
但是如果你想把它放在一个特定的 x,y 坐标中
plt.legend(loc='upper right',bbox_to_anchor=(x,y))