pythonmatplotlibpweave

How to specify the size of a figure with Pweave (using a .py script)


I am trying to specify the size of a figure with Pweave inside a 'Pweave-compatible' .py script:

#' 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')

However after having compiled the script:

pypublish test.py

I can only witness that the figures are identical in the .html file where I would expect them to have different sizes.

I am wondering what I am doing wrong or even if this is supported (couldn't find a specific example or related statement in Pweave doc)


Solution

  • Seeing the lack of popularity of Pweave and support, I decided to go with PyLatex, which for sure is not the same but allowed me to pretty much achieve what I wanted.