相关疑难解决方法(0)

插入轴的具体位置

我想创建一组轴,以在父组轴的特定位置形成插入.因此,不宜只使用参数loc=1,2,3inset_axes,如下所示:

inset_axes = inset_axes(parent_axes,
                    width="30%", # width = 30% of parent_bbox
                    height=1., # height : 1 inch
                    loc=3)
Run Code Online (Sandbox Code Playgroud)

但是,我想要接近这一点.这里这里的答案似乎是比我复杂得多的问题的答案.

所以,问题是我可以在上面的代码中替换一个参数,它允许插入轴在父轴中的自定义位置吗?我试图使用bbox_to_anchor但不理解文档中的规范或行为.具体来说,我尝试过:

 inset_axes = inset_axes(parent_axes,
                        width="30%", # width = 30% of parent_bbox
                        height=1., # height : 1 inch
                        bbox_to_anchor=(0.4,0.1))
Run Code Online (Sandbox Code Playgroud)

尝试使插图的左侧和底部的锚点分别位于x轴和y轴的40%和10%处.或者,我试图把它放在绝对坐标中:

inset_axes = inset_axes(parent_axes,
                            width="30%", # width = 30% of parent_bbox
                            height=1., # height : 1 inch
                            bbox_to_anchor=(-4,-100))
Run Code Online (Sandbox Code Playgroud)

这些都没有正常工作,并给了我一个我无法解释的警告.

更一般地说,它似乎loc是属于许多函数的一个非常标准的参数matplotlib,因此,是否可以在任何地方使用这个问题的一般解决方案?看起来就是这样bbox_to_anchor但又一次,我无法弄清楚如何正确使用它.

python graph matplotlib

9
推荐指数
1
解决办法
4833
查看次数

在Matplotlib/Python中将小照片/图像添加到大图中

我有一个大图,我在matplotlib中生成.我想在某个(x,y)坐标处为此图添加一些图标.我想知道在matplotlib中是否有任何方法可以做到这一点

谢谢

python matplotlib

4
推荐指数
1
解决办法
3543
查看次数

标签 统计

matplotlib ×2

python ×2

graph ×1