我有一个大小相等的 3x2 网格。我使用命令
plt.suptitle("Awesome title") # (1)
Run Code Online (Sandbox Code Playgroud)
在 6 个图上方有一个居中的标题。我使用命令
plt.title("Almost awesome title") # (2)
Run Code Online (Sandbox Code Playgroud)
对于每个子图上方的特定标题。现在是棘手的部分:我想要在子图的第一行和第二行之间有一个居中的标题。将 (2) 的位置参数操作为 (1.1 , 1.0) 之类的值后,我似乎无法获得格式正确/格式良好的图形。
TL; DR:我想要一个附加的plt.suptitle("Title"),如下图所示:(photoshopped)
I have a function that accepts certain literals for a specific argument:
from typing import Literal
def fn(x: Literal["foo", "bar", "foo|bar"]) -> None:
reveal_type(x)
Run Code Online (Sandbox Code Playgroud)
The third contains a pipe symbol (|), "foo|bar". This is interpreted by mypy as an error, as the name foo is not defined.
I guess this happens due to how forward references are evaluated? I use Python 3.8 with:
from __future__ import annotations
Run Code Online (Sandbox Code Playgroud)
Is there a way to make this work? I can …