Skip to content

Commit

Permalink
piechart-updated!
Browse files Browse the repository at this point in the history
  • Loading branch information
MSaiKiran9 committed Oct 9, 2023
1 parent 7ba4575 commit 791f624
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions Matplotlib/Matplotlib_Create_Piechart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"tags": []
},
"source": [
"**Author:** [SaiKiran M]()"
"**Author:** [SaiKiran M](www.linkedin.com/in/msaikiran9)"
]
},
{
Expand Down Expand Up @@ -111,7 +111,8 @@
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"import naas"
]
},
{
Expand All @@ -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"
]
},
{
Expand All @@ -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\""
]
},
{
Expand Down Expand Up @@ -188,7 +190,7 @@
"source": [
"plt.pie(sizes, labels=labels, autopct='%1.1f%%')\n",
"plt.axis(\"equal\")\n",
"plt.show()"
"plt.savefig(piechart_path)"
]
},
{
Expand All @@ -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": {
Expand Down

0 comments on commit 791f624

Please sign in to comment.