bbox_to_anchor and loc in matplotlib

后端 未结 2 645
梦谈多话
梦谈多话 2020-12-24 06:00

I came across matplotlib code which customizes legend location using keywords loc and bbox_to_anchor. For example :

fi         


        
2条回答
  •  无人及你
    2020-12-24 06:18

    The explanation of @Gabriel is slightly misleading. bbox_to_anchor=[x0, y0] will create a bounding box with lower left corner at position [x0, y0]. The extend of the bounding box is zero - being equivalent to bbox_to_anchor=[x0, y0, 0, 0]. The legend will then be placed 'inside' this box and overlapp it according to the specified loc parameter. So loc specifies where inside the box the legend sits.

    Also see this question What does a 4-element tuple argument for 'bbox_to_anchor' mean in matplotlib?

提交回复
热议问题