I want to change legend position because legend names a little bit longer(X Position according to ...
) so that I want to put this name vertical (right side of graph or under the plot). I have three subplot which have only one legend because X and Y
are same thing so one legend is enough to Show data's name. My simulation code not nice if it has long name and shows horizontal. Also, I don't want to put inside of plot because of simulation it can cover data result. I want to put out of plot, it can under the plot or vertical right side of plot. How can I do this? Thanks
import matplotlib.pyplot as plt
plt.subplot(311)
plt.plot([1, 2, 3], label="X Position according to ...")
plt.plot([3, 2, 1], label="Y Position according to ...")
plt.subplot(312)
plt.plot([1, 2, 3], label="X Position according to ...")
plt.plot([3, 2, 1], label="Y Position according to ...")
plt.legend(bbox_to_anchor=(1.05, 0.45), loc=8, borderaxespad=0.)
plt.subplot(313)
plt.plot([1, 2, 3], label="X Position according to ...")
plt.plot([3, 2, 1], label="Y Position according to ...")
plt.show()