大胆一些但不是所有字符的字符

发布于 2025-02-12 11:12:52 字数 380 浏览 0 评论 0原文

是否有可能以粗体字母有一些轴标题的字母?我在文档中找不到任何东西,但想知道是否有解决方法。

示例:

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

ax1.set(title="A. line with positive slope")
ax2.set(title="B. line with negative slope")

# want...
ax1.set(title="bold(A.) line with positive slope")

我希望A.和B.在标题中大胆。

Is it possible to have some but not all letters of an axes title in bold? I could not find anything in the documentation, but wondering if there is a workaround.

Example:

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

ax1.set(title="A. line with positive slope")
ax2.set(title="B. line with negative slope")

# want...
ax1.set(title="bold(A.) line with positive slope")

I would like A. and B. to be bold in the titles.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素罗衫 2025-02-19 11:12:52

尝试以下尝试:

import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

# ax1 = plt.gca() 
ax1.set(title=r'$\bf{A}$. line with positive slope')
ax2.set(title=r'$\bf{B}$. line with negative slope')

“在此处输入图像描述”

Try this:

import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

# ax1 = plt.gca() 
ax1.set(title=r'$\bf{A}$. line with positive slope')
ax2.set(title=r'$\bf{B}$. line with negative slope')

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文