From 791f6242d0efa87f4f71e8118395f507c192de21 Mon Sep 17 00:00:00 2001 From: M Sai Kiran Date: Mon, 9 Oct 2023 13:51:32 +0200 Subject: [PATCH] piechart-updated! --- Matplotlib/Matplotlib_Create_Piechart.ipynb | 46 ++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/Matplotlib/Matplotlib_Create_Piechart.ipynb b/Matplotlib/Matplotlib_Create_Piechart.ipynb index d6d5a4f4f6..2e8d2cfd17 100644 --- a/Matplotlib/Matplotlib_Create_Piechart.ipynb +++ b/Matplotlib/Matplotlib_Create_Piechart.ipynb @@ -41,7 +41,7 @@ "tags": [] }, "source": [ - "**Author:** [SaiKiran M]()" + "**Author:** [SaiKiran M](www.linkedin.com/in/msaikiran9)" ] }, { @@ -111,7 +111,8 @@ }, "outputs": [], "source": [ - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "import naas" ] }, { @@ -124,8 +125,7 @@ "source": [ "### Setup variables\n", "- `labels`: list of labels for each slice of the pie chart\n", - "- `sizes`: list of sizes for each slice of the pie chart\n", - "- `fig_path`: The file path or name for the output image file of the graph, saved as \"fig.png\"." + "- `sizes`: list of sizes for each slice of the pie chart" ] }, { @@ -138,9 +138,11 @@ }, "outputs": [], "source": [ + "#inputs:\n", "labels = [\"hotdogs\", \"salads\", \"sandwich\", \"burger\"] #visualize shares of food of a hotel by giving labels.\n", "sizes = [14.5, 30.5, 45, 10] #here hotdogs shares corresponds to 14.5 and so on.\n", - "fig_path = \"fig.png\"" + "#outputs:\n", + "piechart_path=\"pie.png\"" ] }, { @@ -188,7 +190,7 @@ "source": [ "plt.pie(sizes, labels=labels, autopct='%1.1f%%')\n", "plt.axis(\"equal\")\n", - "plt.show()" + "plt.savefig(piechart_path)" ] }, { @@ -204,62 +206,58 @@ }, { "cell_type": "markdown", - "id": "4f02c06a-c4ce-43d1-b2e9-693b44ecc7a0", + "id": "f57a2a82-c67b-4228-bdfc-f13d6acc2f8d", "metadata": { "papermill": {}, "tags": [] }, "source": [ - "### Save figure" + "### Display result" ] }, { "cell_type": "code", "execution_count": null, - "id": "52dbb6ec-9828-490c-8d52-5261040e8e29", + "id": "0c587394-c49d-4c86-93a1-97ad79cafe56", "metadata": { "papermill": {}, "tags": [] }, "outputs": [], "source": [ - "fig.savefig(fig_path)" + "plt.show()" ] }, { "cell_type": "markdown", - "id": "fbe2f1c6-0312-4eae-a97d-d2ad17a8e70e", + "id": "f0692308-7069-4700-a0f1-74953b63b8e2", "metadata": { "papermill": {}, "tags": [] }, "source": [ - "### Share asset with naas" + " " ] }, { "cell_type": "code", "execution_count": null, - "id": "a7623066-e856-43ba-a16c-328bd47a4c0e", + "id": "c23f483f-ff77-4fbd-83a1-fb12b59928b7", "metadata": { - "papermill": {}, "tags": [] }, "outputs": [], "source": [ - "naas.asset.add(fig_path)" + "naas.asset.add(piechart_path)" ] }, { - "cell_type": "markdown", - "id": "f0692308-7069-4700-a0f1-74953b63b8e2", - "metadata": { - "papermill": {}, - "tags": [] - }, - "source": [ - " " - ] + "cell_type": "code", + "execution_count": null, + "id": "52c66aad-cb4d-44da-b9f5-116c6e65d6ec", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {