Skip to content

Commit

Permalink
update plotly layout to make readable on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
biphasic committed Oct 25, 2023
1 parent 71484ae commit 742762b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 11 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -21,14 +21,31 @@
" }\n",
")\n",
"\n",
"# Shorten the names of the encodings and frameworks to make the plotly legend readable on mobile\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"numpy/brotli (Q=1)\", \"Encoding\"] = \"brotli (Q=1)\"\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"numpy/brotli (Q=6)\", \"Encoding\"] = \"brotli (Q=6)\"\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"numpy/brotli (Q=11)\", \"Encoding\"] = \"brotli (Q=11)\"\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"numpy (pickle)\", \"Encoding\"] = \"pickle\"\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"numpy (UNDR)\", \"Encoding\"] = \"UNDR\"\n",
"dataframe.loc[dataframe[\"Framework\"] == \"numpy/brotli\", \"Framework\"] = \"brotli\"\n",
"dataframe.loc[dataframe[\"Encoding\"] == \"eventstream\", \"Encoding\"] = \"es\"\n",
"\n",
"# temporary hack because I forgot to add the number of events to the results, \n",
"# should be fixed in current version though\n",
"if len(results) < 17:\n",
" number_of_events = 1e7\n",
"else:\n",
" number_of_events = results[-1]\n",
"\n",
"title = f\"Reading the same {round(number_of_events / 1e6)} million events from different file formats.\"\n",
"title = f\"Reading the same {round(number_of_events / 1e6)} million events from different file formats.\"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"figure = plotly.express.scatter(\n",
" dataframe,\n",
Expand All @@ -39,11 +56,22 @@
" template=\"plotly_dark\",\n",
" title=title,\n",
")\n",
"figure.update_layout(\n",
" # legend=dict(orientation=\"v\", yanchor=\"top\", y=0, xanchor=\"right\", x=0.99, entrywidth=0.8, entrywidthmode=\"fraction\"),\n",
" margin=dict(l=10, r=10, t=80, b=10),\n",
")\n",
"figure.update_traces(marker_size=13)\n",
"figure.write_json(\"file_read_benchmark.json\")\n",
"# figure.update_layout(height=600, width=900)\n",
"# figure.write_image(\"file_read_benchmark.png\")\n",
"\n",
"# figure.write_image(\"file_read_benchmark.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"figure = plotly.express.scatter(\n",
" dataframe,\n",
Expand Down Expand Up @@ -74,6 +102,13 @@
"# figure.update_layout(height=600, width=900)\n",
"# figure.write_image(\"file_read_benchmark_log.png\", scale=2)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
"fig.update_layout(\n",
" title=f\"8k neurons, 1 Linear + 1 LIF layer, {n_steps} time steps, batch size {batch_size}\",\n",
" xaxis={'categoryorder':'total ascending'},\n",
" legend=dict(orientation=\"h\", yanchor=\"bottom\", y=1.01, xanchor=\"right\", x=1),\n",
" margin=dict(l=10, r=10, t=80, b=10),\n",
")\n",
"# increase size of facet titles\n",
"fig.update_annotations(font_size=14)\n",
Expand Down Expand Up @@ -95,6 +97,8 @@
"fig.update_layout(\n",
" title=f\"4k neurons, 1 Linear + 1 LIF layer, {n_steps} time steps, batch size {batch_size}\",\n",
" xaxis={'categoryorder':'total ascending'},\n",
" legend=dict(orientation=\"h\", yanchor=\"bottom\", y=1.01, xanchor=\"right\", x=1),\n",
" margin=dict(l=10, r=10, t=80, b=10),\n",
")\n",
"# increase size of facet titles\n",
"fig.update_annotations(font_size=14)\n",
Expand Down Expand Up @@ -134,7 +138,8 @@
"fig.update_layout(\n",
" title=f\"512 neurons, 1 Linear + 1 LIF layer, {n_steps} time steps, batch size {batch_size}\",\n",
" xaxis={'categoryorder':'total ascending'},\n",
" yaxis_title=\"Time [s]\",\n",
" legend=dict(orientation=\"h\", yanchor=\"bottom\", y=1.01, xanchor=\"right\", x=1),\n",
" margin=dict(l=10, r=10, t=80, b=10),\n",
")\n",
"# increase size of facet titles\n",
"fig.update_annotations(font_size=14)\n",
Expand Down

0 comments on commit 742762b

Please sign in to comment.