2

我正在尝试在“Pweave 兼容”.py 脚本中使用 Pweave 指定图形的大小:

#' 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 文档中找不到特定示例或相关语句)

4

2 回答 2

4

作为 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 中)中还有一个错误,它不喜欢#'#+行之间的额外空格(现在已在 github 中修复)。

我还在pweaveSO 上添加了标签。所以如果有人问

于 2016-01-18T07:38:56.037 回答
0

看到 Pweave 缺乏普及和支持,我决定使用 PyLatex,这肯定是不一样的,但让我几乎可以实现我想要的。

于 2015-01-30T12:59:05.483 回答