问题描述
I have the following graph, consisting of several lines:
Now, I would like to label all the lines in the plot. However, using legend()
crams all the labels together in a box, which makes the plot somewhat difficult to interpret. What I'd like to to instead is to use inline labels. My ideal output would use labels like the following matplotlib contour plot, but with text labels for lines instead of numbers:
I haven't been able to find out how to do this in the matplotlib documentation. Is there a way to achieve this? If not, what other software could I use to generate this type of plot?
May I suggest another solution to your problem. Since in your case legend overlaps the charts you might just want to move the legend outside of the plot.
Method do move legend outside of plot is described here:Moving matplotlib legend outside of the axis makes it cutoff by the figure box
这篇关于如何在 matplotlib 中绘制内联线标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!