Tutorial 02: a workaround for the issue of saving an empty .png file
"import covasim as cv\n",
"\n",
"cv.options(jupyter=True, verbose=0) # Standard options for Jupyter notebook\n",
- "\n",
+ "cv.options(returnfig=True)\n",
"sim = cv.Sim()\n",
"sim.run()"
]
"metadata": {},
"outputs": [],
"source": [
- "sim.plot('overview', n_cols=5, figsize=(20,20), dateformat='concise', dpi=50) # NB: dateformat='concise' is already the default for >2 columns"
+ "my_fig = sim.plot('overview', n_cols=5, figsize=(20,20), dateformat='concise', dpi=50) # NB: dateformat='concise' is already the default for >2 columns"
]
},
{
"metadata": {},
"outputs": [],
"source": [
- "cv.savefig('my-fig.png')"
+ "cv.savefig(fig=my_fig, filename='my-fig.png')"
]
},
{
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.7"
+ "version": "3.9.10"
},
"pycharm": {
"stem_cell": {
