环绕情节标题
我正在尝试为我的(非常简单的)情节添加标题。这是到目前为止我的标题代码:
t = "Figure 1: This caption is too long to be displayed over one line, in fact it will have to be spread over multiple lines. The whole plot is described in this caption so it goes on and on forever."
plt.figtext(0.1, -0.3, t, wrap = True, horizontalalignment = 'left', fontsize = 12, style = 'italic')
这些是我导入的库:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
我认为 plt.figtext 中的 wrap = True 会整理换行,但事实并非如此。相反,我的标题会在一行上继续,并且不会换行。我正在使用 Jupyter 笔记本。
我确信有一个简单的方法可以解决这个问题,但我只是无法弄清楚。
感谢您的帮助!
I'm trying to wrap the caption for my (very simple) plot. This is my code for the caption so far:
t = "Figure 1: This caption is too long to be displayed over one line, in fact it will have to be spread over multiple lines. The whole plot is described in this caption so it goes on and on forever."
plt.figtext(0.1, -0.3, t, wrap = True, horizontalalignment = 'left', fontsize = 12, style = 'italic')
And these are the libraries I have imported:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
I thought the wrap = True
in plt.figtext
would sort out the line wrapping, but it doesn't. Instead, my caption goes continues on one line and doesn't wrap. I'm using a Jupyter notebook.
I'm sure there is a simple way to fix this, I have just not been able to figure it out.
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Wrap 在 Jupyter Notebook 中不起作用:
查看包装文档。
Wrap does not work in Jupyter notebook:
Checkout wrap documentation.