Python 如何使用Pweave(使用.py脚本)指定地物的大小

Python 如何使用Pweave(使用.py脚本)指定地物的大小,python,matplotlib,pweave,Python,Matplotlib,Pweave,我试图在“Pweave compatible”中指定Pweave的图形大小。py脚本: #' do the imports import matplotlib.pyplot as plt #' normal figure plt.figure(1) plt.plot(range(30), color='k', linestyle='dashed', marker='o') #' figure super wide #+ fig = True, width = '24 cm' plt.

我试图在“Pweave compatible”中指定Pweave的图形大小。py脚本:

#' do the imports

import matplotlib.pyplot as plt

#' normal figure

plt.figure(1)
plt.plot(range(30), color='k', linestyle='dashed', marker='o')

#' figure super wide


#+ fig = True, width = '24 cm'
plt.figure(2)
plt.plot(range(30), color='k', linestyle='dashed', marker='o')
但是,在编译脚本之后:

pypublish test.py
我只能看到这些数字在.html文件中是相同的,我希望它们有不同的大小


我想知道我做错了什么,或者即使这一点得到了支持(在Pweave文档中找不到具体的示例或相关声明)

鉴于Pweave和支持缺乏普及性,我决定选择PyLatex,这肯定是不一样的,但让我几乎实现了我想要的。

作为Pweave的作者,我将回答这个问题,因为我刚刚注意到了这一点。您需要将宽度设置为有效的html,以便将宽度设置为1200即可

下面的代码示例将更改HTML输出中的图形大小:

#' figure super wide

#+ fig = True, width = '1200'

plt.figure(2)
plt.plot(range(30), color='k', linestyle='dashed', marker='o')
脚本读取器(0.23.2)中还有一个bug,它不喜欢
#
#+
行之间的额外空格(现在在github中已修复)


我还在SO上添加了
pweave
标记。所以如果有人问

我不知道pyweave,但是你试过类似于
plt的东西吗。图(2,figsize=(10,6))
?@farenorth很遗憾,它没有改变任何事情。。。我开始认为我应该放弃Pweave,但我不知道还有其他(好的)选择。。。