{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%python module GraphLibrary\n",
"\n",
"from robot.api import logger\n",
"\n",
"import io\n",
"import urllib\n",
"import base64\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"class GraphLibrary:\n",
" def log_as_graph(self, *args):\n",
" \"\"\"Log list of values as a graph\"\"\"\n",
" buffer = io.BytesIO()\n",
" # Plot\n",
" plt.plot(list(map(float, *args)))\n",
" plt.savefig(buffer, format='png')\n",
" plt.clf()\n",
" # Log\n",
" uri = 'data:image/png;base64,' + \\\n",
" urllib.parse.quote(base64.b64encode(buffer.getvalue()))\n",
" html = ''\n",
" logger.info(html, html=True)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"