How to put the legend out of the plot

后端 未结 17 3154
时光说笑
时光说笑 2020-11-21 04:42

I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, a

17条回答
  •  [愿得一人]
    2020-11-21 05:17

    To place the legend outside the plot area, use loc and bbox_to_anchor keywords of legend(). For example, the following code will place the legend to the right of the plot area:

    legend(loc="upper left", bbox_to_anchor=(1,1))
    

    For more info, see the legend guide

提交回复
热议问题