I have a scatter 3d plot using matplotlib.
What I'm trying to do is to position the legend inside the plot. I have read the documentation and it seems that is only possible to select predefined positions or only specify x and y coordinates.
Is there a way to position the legend specifying the 3 coordinates?
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
#more code
ax.legend(loc=(0.5,0.5,0.5), frameon=0)
The last line is what I thought might work but obviously is not working.
I'm trying to position the legend inside the axes, sort of like:

I reached that position by trial and error using ax.legend(loc=(0.15,0.65),frameon=0) because the legend doesn't move as the axes are rotated. The issue is that I'll be doing several plots thus I'm trying to avoid the trial and error approach.
Thanks.


centerand its variants as value for thelocparameter. But in my case that is not where Im trying to place the legend. - Arravaltextcould be an option but it seems to much work for such a simple task. - Arravalax.legend(loc=(0.5,0.5), frameon=0)not do exactly what you want? - ImportanceOfBeingErnest