在 matplotlib 中,我最近遇到了术语“标准化图形坐标”,它显然是由四个参数指定的矩形。
很明显,一个矩形可以用四个数字来描述,我猜这四个数字以某种方式描述了矩形的尺寸和位置。但是,我还没有找到关于这些参数中的哪个指定哪个值的答案。
此外,我不确定这是 matplotlib 特定的术语还是一般含义,因为 matplotlib 文档没有引用或链接与该术语相关的任何来源。
有人可以解释一下这个问题吗?
最佳答案
有几个函数使用标准化图形坐标。
一般来说,可能性是
(left,bottom,width,height)
(这在 matplotlib 中称为“边界”);或(左、下、右、上)
(称为“范围”)。
希望文档能够清楚地说明在各自的情况下需要哪个 4 元组。
在这里,您似乎对 GridSpec
的 tight_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/