matplotlib - 'normalized figure coordinates' 是如何工作的?

标签 matplotlib

在 matplotlib 中,我最近遇到了术语“标准化图形坐标”,它显然是由四个参数指定的矩形。

很明显,一个矩形可以用四个数字来描述,我猜这四个数字以某种方式描述了矩形的尺寸和位置。但是,我还没有找到关于这些参数中的哪个指定哪个值的答案。

此外,我不确定这是 matplotlib 特定的术语还是一般含义,因为 matplotlib 文档没有引用或链接与该术语相关的任何来源。

有人可以解释一下这个问题吗?

最佳答案

有几个函数使用标准化图形坐标。

一般来说,可能性是

  • (left,bottom,width,height)(这在 matplotlib 中称为“边界”);或
  • (左、下、右、上)(称为“范围”)。

希望文档能够清楚地说明在各自的情况下需要哪个 4 元组。

在这里,您似乎对 GridSpectight_layout 参数 rect 感兴趣。来自 its documentation

rect : tuple of 4 floats, optional
(left, bottom, right, top) rectangle in normalized figure coordinates that the whole subplots area (including labels) will fit into. Default is (0, 0, 1, 1).

关于matplotlib - 'normalized figure coordinates' 是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56627988/

相关文章:

python - 如何设置注释框的 z-index (matplotlib)

python - Python 图中的线条比应有的长度长,与其他线条重叠

python - 将 matplotlib 图例条目集中在不完整/未填充的行中?

python - 将自定义刻度标签均匀地分布在颜色条上

python - CDF累积分布函数误差

python - Pandas 条形图到 numpy 数组

python - 如何在 matplotlib 中添加额外的 y 轴标签

numpy - 是否有安装以下软件包的特定顺序?

python - 控制标签缩写 matplotlib

python - Matplotlib - 绘制宽度等于一系列值的线,而不仅仅是一个值