{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams[\"font.family\"] = \"Times New Roman\"\n",
    "plt.rcParams[\"font.size\"] = 16\n",
    "\n",
    "g_label_fontsize = 16\n",
    "\n",
    "colors = [\n",
    "    \"#455D7A\",\n",
    "    \"#233142\",\n",
    "    \"#F95959\",\n",
    "]\n",
    "\n",
    "edgecolors = [\n",
    "    \"#FFFFFF\",\n",
    "    \"#FFFFFF\",\n",
    "    \"#FFFFFF\",\n",
    "]\n",
    "\n",
    "hatches = [\"\\\\\\\\\", \"\", \"\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 48992 characters]",
      "text/plain": [
       "<Figure size 2100x840 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(\n",
    "    figsize=(7, 14 / 5), ncols=1, nrows=1, constrained_layout=True, dpi=300\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_name = [\n",
    "    \"FSDP\",\n",
    "    \"XLA\",\n",
    "    \"DLRover-Lynx\"\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_data = [2, 4, 6, 8, 10, 12, 14, 16]\n",
    "data_a = [53, 53, 53, 53, 53, 53, 53, 53]\n",
    "data_b = [53, 53, 53, 53, 53, 53, 53, 53]\n",
    "data_c = [65, 65, 65, 65, 65, 65, 65, 65]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "legend_labels = [\"FSDP\", \"XLA\", \"DLRover-Lynx\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(13.333333333333346, 0.5, 'MFU (%)')"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ax.plot(x_data, data_a, marker=\"o\", color=colors[0], label=legend_labels[0])\n",
    "ax.plot(x_data, data_b, marker=\"x\", color=colors[1], label=legend_labels[1])\n",
    "ax.plot(x_data, data_c, marker=\"o\", color=colors[2], label=legend_labels[2])\n",
    "\n",
    "ax.set_ylim(0, 100)\n",
    "\n",
    "ax.grid(True)\n",
    "\n",
    "ax.set_ylabel(\"MFU (%)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x7f57182abec0>"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ax.legend(\n",
    "    ncol=3,\n",
    "    loc=\"upper center\",\n",
    "    frameon=True,\n",
    "    shadow=False,\n",
    "    fontsize=g_label_fontsize,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 97632 characters]",
      "text/plain": [
       "<Figure size 2100x840 with 1 Axes>"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fig.savefig(\"scalability.pdf\", bbox_inches=\"tight\", dpi=1000)\n",
    "fig"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
