{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyOajwss9kz6VaN+ZXiC2C2/"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","source":["# Donut Charts\n","\n","A donut chart is a modified pie chart with an empty circle at the middle of the pie. We can create a donut chart by creating a graph object and specifying a value for the `hole` parameter. This example does not use `plotly.express` and instead creates the graph object manually."],"metadata":{"id":"0iAge2X1eqUq"}},{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":542},"id":"WXEySQj9eoCp","executionInfo":{"status":"ok","timestamp":1706150285286,"user_tz":300,"elapsed":286,"user":{"displayName":"Katherine Walden","userId":"17094108395123900917"}},"outputId":"9ed37e15-b108-435d-8117-7a5c5240f6b3"},"outputs":[{"output_type":"display_data","data":{"text/html":["\n","\n","\n","
\n","
\n","\n",""]},"metadata":{}}],"source":["import plotly.graph_objects as go # import statement\n","labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen'] # slice labels\n","values = [4500, 2500, 1053, 500] # slice values\n","fig = go.Figure(data=[go.Pie(labels=labels, values=values, hole=.3)]) # create figure\n","fig # show output"]},{"cell_type":"markdown","source":["There's a lot to get into in terms of the differences between `plotly.express` function syntax and `plotly.graph_object` syntax. For our purposes, we can focus on how values, labels, and parameters are passed to `go.Figure()` and `go.Pie()` to create the plot."],"metadata":{"id":"e6Xdwkv-e4Ru"}}]}