CINXE.COM
Pie charts in MATLAB
<!DOCTYPE html> <html> <head> <!-- This page was last built at 2024-11-19 16:02 --> <meta charset="utf-8" /> <link rel="canonical" href="https://plotly.com/matlab/pie-charts/" /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@1,500&display=swap" rel="stylesheet" /> <!-- Media query magic - http://stackoverflow.com/questions/19945658/my-iphone-thinks-its-980px-wide --> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="/all_static/javascripts/algolia/instantsearch.js"></script> <script src="/all_static/javascripts/algolia/polyfill.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script> const theme = localStorage.getItem('theme'); if (theme === "dark-mode") { var root = document.getElementsByTagName('html')[0]; // '0' to assign the first (and only `HTML` tag) root.setAttribute('class', 'dark-mode'); } </script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous"> <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script> <link href="https://esm.sh/@markprompt/css@0.18.0?css" rel="stylesheet" /> <link href="/all_static/css/markprompt.css" rel="stylesheet" /> <!-- code highlighting --> <!-- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script> <script> hljs.initHighlightingOnLoad(); </script>--> <!-- Mathjax --> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script> <!-- Plotly.js --> <script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.js"></script> <script type="text/javascript"> if (typeof require !== "undefined") { require.undef("plotly"); requirejs.config({ paths: { plotly: [ "https://cdn.plot.ly/plotly-2.35.2.min", ], }, }); require(["plotly"], function(Plotly) { window._Plotly = Plotly; }); } </script> <!-- //// Stylesheets --> <style> .mcode { border: 1px solid #cfcfcf; border-radius: 2px; background: #f7f7f7; padding: 10px; } </style> <!-- Fonts --> <link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic|Ubuntu+Mono:400,700|Asap" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" /> <!-- Main Stylesheets --> <link rel="stylesheet" type="text/css" href="/all_static/css/main.css?version=false" /> <link rel="stylesheet" type="text/css" href="/all_static/css/improve.css?version=2024-11-19-16-02"> <!-- LOCAL DEV STYLESHEET --> <!--<link rel="stylesheet" type="text/css" href="http://api.plotly.dev/all_static/css/main.css">--> <!-- Icon --> <link rel="shortcut icon" href="https://dash.plotly.com/assets/favicon.ico" /> <!-- Google Tags--> <!-- Google Tag Manager Tag --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-N6T2RXG');</script> <!-- META TAGS --> <!-- Capture language --> <!-- Create a title --> <!-- Count number of plots on the page --> <!-- SEO Tags - title, meta_description --> <title> Pie charts in MATLAB </title> <meta name="description" content="Over 12 examples of Pie Charts including changing color, size, log axes, and more in MATLAB."> <!-- Bing tags --> <meta name="msvalidate.01" content="D319859A832F9F1D15A7646E2A42150A" /> <!-- Facebook tags --> <meta property="og:title" content= Pie charts in MATLAB /> <meta property="og:type" content="website"/> <meta property="og:image" content="https://help.plot.ly/images/twitter-default.png"> <meta property="og:description" content="Over 12 examples of Pie Charts including changing color, size, log axes, and more in MATLAB."/> <meta property="og:url" /> <meta property="fb:admins" content="1123751525"/> <meta property="fb:admins" content="22418"/> <!-- twitter tags --> <meta name="twitter:card" content="photo" /> <meta name="twitter:title" content= Pie charts in MATLAB /> <meta name="twitter:url" content="https://plotly.com/matlab/pie-charts/"/> <meta name="twitter:description" content="Over 12 examples of Pie Charts including changing color, size, log axes, and more in MATLAB."/> <meta name="twitter:image" content="https://help.plot.ly/images/twitter-default.png"> <meta name="twitter:site" content="@plotlygraphs"/> </head> <body data-spy="scroll" data-target=".watch" style="position:relative;" class="darkmode"> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6T2RXG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <!--[if lt IE 10]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <div class="menu-mobile"> <div class="switch-mode"> <div class="icon-dark"></div> <div class="switch"></div> <div class="icon-light"></div> </div> <div class="close-menu"></div> <ul> <li><a style="font-weight: bold;" href="https://community.plotly.com/c/plotly-r-matlab-julia-net/29">Forum</a> </li> <li><a style="font-weight: bold;" href="https://plotly.com/get-pricing/">Pricing</a></li> <li><a style="font-weight: bold;" href="https://dash.plotly.com">Dash</a></li> <!--<li><a style="font-weight: bold;" href="http://plotly.cloud">Dash Cloud</a></li>--> </ul> </div> <div class="header-container"> <header class="header-main --default"> <div class="--wrap"> <div class="--wrap-left"> <div class="-identity"> <a href="https://plotly.com/"><img src="/all_static/images/graphing_library_dark.svg" style="height: 30px;" class="logo-dark"></a> <a href="/graphing-libraries/"><img src="/all_static/images/graphing_library.svg" style="height: 30px;" class="logo-white"></a> </div> </div> <div class="--wrap-right"> <nav class="--nav-meta" role="navigation"> <ul> <li class="languages"> <a class="matlab"> <div class="icon"></div> MATLAB® </a> <ul> <li> <a href="https://plotly.com/python/" class="python"> <div class="icon"></div>Python (v5.24.1) </a> </li> <li> <a href="https://plotly.com/r/" class="r"> <div class="icon"></div>R </a> </li> <li> <a href="https://plotly.com/julia/" class="julia"> <div class="icon"></div>Julia </a> </li> <li> <a href="https://plotly.com/javascript/" class="plotly_js"> <div class="icon"></div>Javascript (v2.35.2) </a> </li> <li> <a href="https://plotly.com/ggplot2/" class="ggplot2"> <div class="icon"></div>ggplot2 </a> </li> <li> <a href="https://plotly.com/matlab/" class="matlab"> <div class="icon"></div>MATLAB </a> </li> <li> <a href="https://plotly.com/fsharp/" class="fsharp"> <div class="icon"></div>F# </a> </li> <li> <a href="https://dash.plotly.com/" class="dash"> <div class="icon"></div>Dash </a> </li> </ul> </li> <li><a style="font-weight: bold;" href="https://community.plotly.com/c/plotly-r-matlab-julia-net/29">Forum</a> </li> <li><a style="font-weight: bold;" href="https://plotly.com/get-pricing/">Pricing</a></li> <li><a style="font-weight: bold;" href="https://dash.plotly.com">Dash</a></li> <!--<li><a style="font-weight: bold;" href="http://plotly.cloud">Dash Cloud</a></li>--> <iframe src="https://ghbtns.com/github-btn.html?user=plotly&repo=plotly_matlab&type=star&count=true&size=large" style="padding-top: 5px;" frameborder="0" scrolling="0" width="160px" height="40px"></iframe> </ul> <div class="switch-mode"> <div class="icon-dark"></div> <div class="switch"></div> <div class="icon-light"></div> </div> </nav> </div> <div class="menu-icon"> <span></span><span></span><span></span> </div> </div> </header> </div> <main class="--page page--single --index"> <div class="--wrap"> <!-- aside - Main Sidebar--> <!-- START OF GGPLOT CUSTOM LAYOUT --> <aside class="--sidebar-container"> <div class="--sidebar-fixed reference" data-spy="affix" id="where"> <div class="brand"> <a href="/graphing-libraries/"><img src="/all_static/images/graphing_library.svg" style="height: 30px;"></a> </div> <details style="color: white;margin-top: 20px;" > <summary>Quick Reference</summary> <nav class="--sidebar-body watch" id="where"> <ul class="--sidebar-list" style="margin-left: 15px;"> <!-- Getting Started --> <li class="--sidebar-item"> <a href="/matlab/getting-started" class="js-splash--navigation-item">Getting Started</a> </li> <li class="--sidebar-item"> <a href="/matlab/is-plotly-free" class="js-splash--navigation-item">Is Plotly Free?</a> </li> <!-- Reference Pages --> <li class="--sidebar-item"> <a href="/matlab/reference/index/" class="js-splash--navigation-item">Figure Reference</a> </li> <!-- Python Specific --> <!-- JS Specific --> <!-- R Specific --> <!-- Python/v3 Index Page Specific --> <!-- User Guides --> <li class="--sidebar-item"> <a href="/matlab/user-guide/" class="js-splash--navigation-item">User Guide</a> </li> <!-- Github Links --> <li class="--sidebar-item"> <a target="_blank" href="https://github.com/plotly/plotly-graphing-library-for-matlab" class="js-splash--navigation-item">GitHub</a> </li> <li class="--sidebar-item"> <a target="_blank" href="http://community.plotly.com/" class="js-splash--navigation-item">community.plotly.com</a> </li> </ul> </nav> </details> <details style="color: white;margin-top: 20px;" open> <summary>On This Page</summary> <nav class="--sidebar-body watch" id="where"> <ul class="--sidebar-list" id="nav_header_insertion_list"></ul> </nav> </details> </div> <a href="https://go.plotly.com/dash-club?utm_source=Dash+Club+2022&utm_medium=graphing_libraries&utm_content=sidebar" target="_blank"> <img src="https://images.prismic.io/plotly-marketing-website-2/7953022d-73b1-481e-8f6b-9ce9bd80e588_Dash+Club.jpeg?auto=compress,format" style="width: 200px; height: 200px; position: fixed; bottom: 10px; left: 50px" alt="Sign up to Dash Club to get two free cheat sheets as well as tips and tricks, community apps, and deep dives delivered every two month"> </a> </aside> <!-- Main--> <section class="--page-body --tutorial-index --base"> <header class="--welcome"> <div class="--welcome-body"> <!--div.--wrap-inner--> <div class="--title"> <div class="--body"> <div class="nav-breadcrumb-container"> <div> <div class="breadcrumb-nav"> <a href="/matlab"> MATLAB<sup>®</sup> </a> > <a href="/matlab/basic-charts">Basic Charts</a> > <span>Pie Charts</span> </div> </div> <div class="nav-breadcrumb-right"> <div class="--fork"> <a id="forklink" href= "https://github.com/plotly/graphing-library-docs/edit/master/_posts/matlab/md/2021-08-04-pie-charts.md" > <div class="icon"> <svg style="width:20px;height:20px" viewbox="0 0 24 24"> <path fill="#000000" d="M2.6,10.59L8.38,4.8L10.07,6.5C9.83,7.35 10.22,8.28 11,8.73V14.27C10.4,14.61 10,15.26 10,16A2,2 0 0,0 12,18A2,2 0 0,0 14,16C14,15.26 13.6,14.61 13,14.27V9.41L15.07,11.5C15,11.65 15,11.82 15,12A2,2 0 0,0 17,14A2,2 0 0,0 19,12A2,2 0 0,0 17,10C16.82,10 16.65,10 16.5,10.07L13.93,7.5C14.19,6.57 13.71,5.55 12.78,5.16C12.35,5 11.9,4.96 11.5,5.07L9.8,3.38L10.59,2.6C11.37,1.81 12.63,1.81 13.41,2.6L21.4,10.59C22.19,11.37 22.19,12.63 21.4,13.41L13.41,21.4C12.63,22.19 11.37,22.19 10.59,21.4L2.6,13.41C1.81,12.63 1.81,11.37 2.6,10.59Z"> </path> </svg> </div> <span>Suggest an edit to this page</span> </a> </div> </div> </div> <h1> Pie Charts in MATLAB<sup>®</sup> </h1> <p>How to make Pie Charts plots in MATLAB<sup>®</sup> with Plotly. </p> <br> <!-- <div class="db-client-lib"> <label> This page in another language </label> <div class="list-lib-wrap"> <div class="list-lib"> <a href=" /matlab/pie-charts/" class="current list-lib-item matlab"> <div class="item-icon"> </div> <p class="item-language"> MATLAB® </p> </a> <a href=" /python/pie-charts/" class="list-lib-item python"> <div class="item-icon"> </div> <p class="item-language"> Python </p> </a> <a href=" /fsharp/pie-charts/" class="list-lib-item fsharp"> <div class="item-icon"> </div> <p class="item-language"> F# </p> </a> <a href=" /r/pie-charts/" class="list-lib-item r"> <div class="item-icon"> </div> <p class="item-language"> R </p> </a> <a target="_blank" href="https://plotly.com/chart-studio-help/make-a-pie-chart/" class="list-lib-item studio"> <div class="item-icon"> </div> <p class="item-language"> Studio </p> </a> </div> </div> </div> --> </div> </div> </div> </header> <!-- Start Plotly Basics Section --> <section class="tutorial-content"> <h2>Create Pie Chart with Offset Slices</h2> <p>Create a pie chart of vector <code>X</code>.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">3</span> <span class="mf">0.5</span> <span class="mf">2.5</span> <span class="mi">2</span><span class="p">];</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-6862710" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-6862710" )) { Plotly.newPlot("plot-6862710", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0581448289104758, -0.11609291412523, -0.17364817766693, -0.23061587074244, -0.28680323271109, -0.342020143325669, -0.396079766039157, -0.448799180200462, -0.5, -0.549508978070806, -0.597158591702786, -0.642787609686539, 0, 0], "y": [0, 1, 0.998308158271268, 0.993238357741943, 0.984807753012208, 0.973044870579824, 0.957989512315489, 0.939692620785908, 0.918216106880274, 0.893632640323412, 0.866025403784439, 0.835487811412936, 0.802123192755044, 0.766044443118978, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.642787609686539, -0.688726842956339, -0.732053499404015, -0.772603226181159, -0.810222204284774, -0.844767732045437, -0.876108766443613, -0.904126420200716, -0.92871441275927, -0.949779473441478, -0.967241695256842, -0.981034838016753, -0.991106579606214, -0.997418714459543, -0.999947298487173, -0.998682739903781, -0.993629835613218, -0.984807753012208, -0.972249957281849, -0.956004084442718, -0.936131760655124, -0.91270836844998, -0.88582276077704, -0.855576923955223, -0.822085590803578, -0.785475805420399, -0.745886441261443, -0.70346767434535, -0.658380413584558, -0.610795690402688, -0.56089400995377, -0.508864666404365, -0.454905024875955, -0.399219772771431, -0.342020143325669, -0, -0], "y": [0, 0.766044443118978, 0.725020920933593, 0.681247146056654, 0.634889167409923, 0.586122836685214, 0.5351331412787, 0.482113502570349, 0.427265042210381, 0.370795819195961, 0.312920040632154, 0.253857249171008, 0.19383149021107, 0.133070462016454, 0.0718046519793276, 0.0102664623022901, -0.0513106715827897, -0.112693166515321, -0.17364817766693, -0.233944481801648, -0.293353354384846, -0.351649437213737, -0.408611593278231, -0.464023745609363, -0.517675696933242, -0.569363927021314, -0.618892364712294, -0.66607313167725, -0.710727255106447, -0.752685346614524, -0.791788244788658, -0.827887618942318, -0.860846531784368, -0.890539958869116, -0.916855262856863, -0.939692620785908, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(52.683,120.9465,253.113)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.342020143325669, -0.28680323271109, -0.23061587074244, -0.17364817766693, -0.11609291412523, -0.0581448289104754, -1.83697019872103e-16, -0, -0], "y": [-0, -0.939692620785908, -0.957989512315489, -0.973044870579824, -0.984807753012208, -0.993238357741943, -0.998308158271268, -1, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0622928302448517, 0.124343704647485, 0.185911607162915, 0.246757397690294, 0.306644740933334, 0.365341024366395, 0.4226182617407, 0.478253978621318, 0.532032076515336, 0.58374367223479, 0.63318790923414, 0.680172737770919, 0.724515660859273, 0.766044443118978, 0.804597779766668, 0.840025923150772, 0.872191264396605, 0.900968867902419, 0.926246956610309, 0.947927346167132, 0.965925826289068, 0.980172487848544, 0.990611994413053, 0.99720379718118, 0.999922292480975, 0.998756921218922, 0.993712209893243, 0.984807753012208, -0, -0], "y": [-0, -1, -0.998057915804532, -0.992239206600172, -0.982566473233288, -0.969077286229078, -0.951824039861322, -0.930873748644204, -0.90630778703665, -0.878221573370229, -0.846724199228284, -0.811938005715857, -0.773998108266227, -0.733051871829826, -0.689258338483947, -0.64278760968654, -0.593820185573502, -0.542546263865759, -0.489165001109289, -0.433883739117558, -0.376917199621006, -0.318486650251685, -0.258819045102521, -0.198146143199398, -0.136703608310074, -0.0747300935864239, -0.0124663145954158, 0.0498458856606971, 0.111964476103308, 0.17364817766693, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(199.6395,193.2645,41.004)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.984807753012208, 0.972458424105307, 0.956526343599335, 0.93707020879743, 0.914161700397035, 0.887885218402376, 0.858337571176206, 0.82562761877642, 0.789875871891559, 0.751214047852818, 0.70978458535831, 0.665740119697441, 0.619242920408802, 0.570464293443346, 0.519583950035434, 0.466789344606959, 0.412274984143858, 0.356241711589418, 0.298895965894517, 0.240449021450939, 0.181116209709856, 0.121116125853205, 0.0606698234407596, 3.06161699786838e-16, 0, 0], "y": [0, 0.17364817766693, 0.233076411047156, 0.291645939454824, 0.349140979812368, 0.405349707693494, 0.460065037731152, 0.513085386565757, 0.564215415522812, 0.613266750283716, 0.660058674898364, 0.704418797582612, 0.746183685847685, 0.785199468621559, 0.821322403143969, 0.854419404546489, 0.884368536166572, 0.911059458789152, 0.934393837160671, 0.954285702277879, 0.970661768116622, 0.983461701633742, 0.992638345047334, 0.998157889576427, 1, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": false}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "22%", "x": 0.707066370655194, "y": 0.842648887430876, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "28%", "x": 0.842648887430876, "y": -0.707066370655194, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "top", "text": "6%", "x": -0.191012995433623, "y": -1.08328852831343, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "middle", "text": "33%", "x": -1.08328852831343, "y": -0.191012995433623, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "11%", "x": -0.376222157658236, "y": 1.0336618828645, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-6862710"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Offset the second and fourth pie slices by setting the corresponding <code>explode</code> elements to 1.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">3</span> <span class="mf">0.5</span> <span class="mf">2.5</span> <span class="mi">2</span><span class="p">];</span> <span class="n">explode</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span><span class="p">];</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">explode</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7065952" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7065952" )) { Plotly.newPlot("plot-7065952", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0581448289104758, -0.11609291412523, -0.17364817766693, -0.23061587074244, -0.28680323271109, -0.342020143325669, -0.396079766039157, -0.448799180200462, -0.5, -0.549508978070806, -0.597158591702786, -0.642787609686539, 0, 0], "y": [0, 1, 0.998308158271268, 0.993238357741943, 0.984807753012208, 0.973044870579824, 0.957989512315489, 0.939692620785908, 0.918216106880274, 0.893632640323412, 0.866025403784439, 0.835487811412936, 0.802123192755044, 0.766044443118978, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0.0984807753012208, -0.74126838498776, -0.787207618257559, -0.830534274705236, -0.87108400148238, -0.908702979585994, -0.943248507346657, -0.974589541744834, -1.00260719550194, -1.02719518806049, -1.0482602487427, -1.06572247055806, -1.07951561331797, -1.08958735490743, -1.09589948976076, -1.09842807378839, -1.097163515205, -1.09211061091444, -1.08328852831343, -1.07073073258307, -1.05448485974394, -1.03461253595634, -1.0111891437512, -0.984303536078261, -0.954057699256444, -0.920566366104799, -0.88395658072162, -0.844367216562664, -0.801948449646571, -0.756861188885779, -0.709276465703909, -0.65937478525499, -0.607345441705586, -0.553385800177175, -0.497700548072651, -0.440500918626889, -0.0984807753012208, -0.0984807753012208], "y": [-0.017364817766693, 0.748679625352285, 0.7076561031669, 0.663882328289961, 0.61752434964323, 0.568758018918522, 0.517768323512007, 0.464748684803656, 0.409900224443688, 0.353431001429268, 0.295555222865461, 0.236492431404315, 0.176466672444377, 0.115705644249761, 0.0544398342126346, -0.00709835546440285, -0.0686754893494827, -0.130057984282014, -0.191012995433623, -0.251309299568341, -0.310718172151539, -0.36901425498043, -0.425976411044924, -0.481388563376056, -0.535040514699935, -0.586728744788007, -0.636257182478987, -0.683437949443943, -0.72809207287314, -0.770050164381217, -0.809153062555351, -0.845252436709011, -0.878211349551061, -0.907904776635809, -0.934220080623556, -0.957057438552601, -0.017364817766693, -0.017364817766693], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(52.683,120.9465,253.113)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.342020143325669, -0.28680323271109, -0.23061587074244, -0.17364817766693, -0.11609291412523, -0.0581448289104754, -1.83697019872103e-16, -0, -0], "y": [-0, -0.939692620785908, -0.957989512315489, -0.973044870579824, -0.984807753012208, -0.993238357741943, -0.998308158271268, -1, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0.0766044443118978, 0.0766044443118976, 0.138897274556749, 0.200948148959382, 0.262516051474812, 0.323361842002191, 0.383249185245232, 0.441945468678292, 0.499222706052597, 0.554858422933216, 0.608636520827234, 0.660348116546687, 0.709792353546038, 0.756777182082817, 0.80112010517117, 0.842648887430876, 0.881202224078566, 0.916630367462669, 0.948795708708503, 0.977573312214317, 1.00285140092221, 1.02453179047903, 1.04253027060097, 1.05677693216044, 1.06721643872495, 1.07380824149308, 1.07652673679287, 1.07536136553082, 1.07031665420514, 1.06141219732411, 0.0766044443118978, 0.0766044443118978], "y": [-0.064278760968654, -1.06427876096865, -1.06233667677319, -1.05651796756883, -1.04684523420194, -1.03335604719773, -1.01610280082998, -0.995152509612858, -0.970586548005304, -0.942500334338882, -0.911002960196938, -0.876216766684511, -0.838276869234881, -0.79733063279848, -0.753537099452601, -0.707066370655194, -0.658098946542156, -0.606825024834413, -0.553443762077943, -0.498162500086212, -0.44119596058966, -0.382765411220339, -0.323097806071175, -0.262424904168052, -0.200982369278728, -0.139008854555078, -0.0767450755640697, -0.0144328753079569, 0.0476857151346536, 0.109369416698276, -0.064278760968654, -0.064278760968654], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(199.6395,193.2645,41.004)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.984807753012208, 0.972458424105307, 0.956526343599335, 0.93707020879743, 0.914161700397035, 0.887885218402376, 0.858337571176206, 0.82562761877642, 0.789875871891559, 0.751214047852818, 0.70978458535831, 0.665740119697441, 0.619242920408802, 0.570464293443346, 0.519583950035434, 0.466789344606959, 0.412274984143858, 0.356241711589418, 0.298895965894517, 0.240449021450939, 0.181116209709856, 0.121116125853205, 0.0606698234407596, 3.06161699786838e-16, 0, 0], "y": [0, 0.17364817766693, 0.233076411047156, 0.291645939454824, 0.349140979812368, 0.405349707693494, 0.460065037731152, 0.513085386565757, 0.564215415522812, 0.613266750283716, 0.660058674898364, 0.704418797582612, 0.746183685847685, 0.785199468621559, 0.821322403143969, 0.854419404546489, 0.884368536166572, 0.911059458789152, 0.934393837160671, 0.954285702277879, 0.970661768116622, 0.983461701633742, 0.992638345047334, 0.998157889576427, 1, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": false}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "22%", "x": 0.707066370655194, "y": 0.842648887430876, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "28%", "x": 0.919253331742773, "y": -0.771345131623848, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "top", "text": "6%", "x": -0.191012995433623, "y": -1.08328852831343, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "middle", "text": "33%", "x": -1.18176930361465, "y": -0.208377813200316, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "11%", "x": -0.376222157658236, "y": 1.0336618828645, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7065952"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Text Labels for Pie Chart</h2> <p>Create a pie chart of vector <code>X</code> and label the slices.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="mi">1</span><span class="p">:</span><span class="mi">3</span><span class="p">;</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Taxes'</span><span class="p">,</span><span class="s1">'Expenses'</span><span class="p">,</span><span class="s1">'Profit'</span><span class="p">};</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">labels</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7215401" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7215401" )) { Plotly.newPlot("plot-7215401", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "Taxes", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784438, -0.895163291355062, -0.920905517944953, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295034, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355063, -0.866025403784439, -0.83360238522112, -0.79801722728024, -0.759404916654707, -0.717911923064442, -0.673695643646558, -0.626923805894107, -0.577773831408251, -0.526432162877356, -0.473093556836011, -0.417960344886784, -0.361241666187154, -0.303152674113045, -0.243913720108378, -0.183749517816571, -0.122888290664715, -0.0615609061339428, -1.83697019872103e-16, -0, -0], "y": [0, 0.5, 0.445738355776539, 0.38978587329268, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633023, 0.0307950585561708, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072082, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.499999999999999, -0.552364972960505, -0.602634636379256, -0.650618300204242, -0.696133945962926, -0.739008917220659, -0.77908057452567, -0.816196912356222, -0.850217135729614, -0.881012194285784, -0.908465271819523, -0.932472229404355, -0.952942000427156, -0.969796936035009, -0.982973099683902, -0.992420509671936, -0.998103328737044, -1, 0, 0], "name": "Expenses", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585724, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101715, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043864, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728689, 0.992114701314478, 0.998026728428272, 1, 0.998026728428272, 0.992114701314478, 0.982287250728689, 0.968583161128631, 0.951056516295154, 0.929776485888252, 0.90482705246602, 0.876306680043863, 0.844327925502015, 0.809016994374948, 0.77051324277579, 0.728968627421412, 0.684547105928689, 0.63742398974869, 0.587785252292473, 0.535826794978997, 0.481753674101716, 0.425779291565073, 0.368124552684678, 0.309016994374948, 0.248689887164855, 0.187381314585726, 0.125333233564305, 0.0627905195293133, 3.06161699786838e-16, -0, -0], "y": [-0, -1, -0.998026728428272, -0.992114701314478, -0.982287250728689, -0.968583161128631, -0.951056516295154, -0.929776485888252, -0.90482705246602, -0.876306680043864, -0.844327925502015, -0.809016994374948, -0.77051324277579, -0.728968627421412, -0.684547105928689, -0.63742398974869, -0.587785252292473, -0.535826794978997, -0.481753674101715, -0.425779291565073, -0.368124552684678, -0.309016994374948, -0.248689887164855, -0.187381314585725, -0.125333233564305, -0.0627905195293133, -2.44929359829471e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585725, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101716, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043863, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728688, 0.992114701314478, 0.998026728428272, 1, -0, -0], "name": "Profit", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "middle", "text": "Profit", "x": 1.1, "y": -2.69422295812418e-16, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "Expenses", "x": -0.952627944162883, "y": -0.549999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "Taxes", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7215401"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Modify Text Label for Pie Chart</h2> <p>Create a labeled pie chart, and then modify the color and font size of the text labels.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="mi">1</span><span class="p">:</span><span class="mi">3</span><span class="p">;</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Taxes'</span><span class="p">,</span><span class="s1">'Expenses'</span><span class="p">,</span><span class="s1">'Profit'</span><span class="p">};</span> <span class="n">p</span> <span class="o">=</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">labels</span><span class="p">);</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7362452" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7362452" )) { Plotly.newPlot("plot-7362452", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "Taxes", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784438, -0.895163291355062, -0.920905517944953, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295034, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355063, -0.866025403784439, -0.83360238522112, -0.79801722728024, -0.759404916654707, -0.717911923064442, -0.673695643646558, -0.626923805894107, -0.577773831408251, -0.526432162877356, -0.473093556836011, -0.417960344886784, -0.361241666187154, -0.303152674113045, -0.243913720108378, -0.183749517816571, -0.122888290664715, -0.0615609061339428, -1.83697019872103e-16, -0, -0], "y": [0, 0.5, 0.445738355776539, 0.38978587329268, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633023, 0.0307950585561708, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072082, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.499999999999999, -0.552364972960505, -0.602634636379256, -0.650618300204242, -0.696133945962926, -0.739008917220659, -0.77908057452567, -0.816196912356222, -0.850217135729614, -0.881012194285784, -0.908465271819523, -0.932472229404355, -0.952942000427156, -0.969796936035009, -0.982973099683902, -0.992420509671936, -0.998103328737044, -1, 0, 0], "name": "Expenses", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585724, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101715, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043864, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728689, 0.992114701314478, 0.998026728428272, 1, 0.998026728428272, 0.992114701314478, 0.982287250728689, 0.968583161128631, 0.951056516295154, 0.929776485888252, 0.90482705246602, 0.876306680043863, 0.844327925502015, 0.809016994374948, 0.77051324277579, 0.728968627421412, 0.684547105928689, 0.63742398974869, 0.587785252292473, 0.535826794978997, 0.481753674101716, 0.425779291565073, 0.368124552684678, 0.309016994374948, 0.248689887164855, 0.187381314585726, 0.125333233564305, 0.0627905195293133, 3.06161699786838e-16, -0, -0], "y": [-0, -1, -0.998026728428272, -0.992114701314478, -0.982287250728689, -0.968583161128631, -0.951056516295154, -0.929776485888252, -0.90482705246602, -0.876306680043864, -0.844327925502015, -0.809016994374948, -0.77051324277579, -0.728968627421412, -0.684547105928689, -0.63742398974869, -0.587785252292473, -0.535826794978997, -0.481753674101715, -0.425779291565073, -0.368124552684678, -0.309016994374948, -0.248689887164855, -0.187381314585725, -0.125333233564305, -0.0627905195293133, -2.44929359829471e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585725, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101716, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043863, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728688, 0.992114701314478, 0.998026728428272, 1, -0, -0], "name": "Profit", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "middle", "text": "Profit", "x": 1.1, "y": -2.69422295812418e-16, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "Expenses", "x": -0.952627944162883, "y": -0.549999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "Taxes", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7362452"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Get the text object for the label 'Profit'. Change its color and font size. Use dot notation to set properties.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="mi">1</span><span class="p">:</span><span class="mi">3</span><span class="p">;</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Taxes'</span><span class="p">,</span><span class="s1">'Expenses'</span><span class="p">,</span><span class="s1">'Profit'</span><span class="p">};</span> <span class="n">p</span> <span class="o">=</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">labels</span><span class="p">);</span> <span class="n">t</span> <span class="o">=</span> <span class="n">p</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span> <span class="n">t</span><span class="o">.</span><span class="n">BackgroundColor</span> <span class="o">=</span> <span class="s1">'cyan'</span><span class="p">;</span> <span class="n">t</span><span class="o">.</span><span class="n">EdgeColor</span> <span class="o">=</span> <span class="s1">'red'</span><span class="p">;</span> <span class="n">t</span><span class="o">.</span><span class="n">FontSize</span> <span class="o">=</span> <span class="mi">14</span><span class="p">;</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7506692" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7506692" )) { Plotly.newPlot("plot-7506692", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "Taxes", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784438, -0.895163291355062, -0.920905517944953, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295034, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355063, -0.866025403784439, -0.83360238522112, -0.79801722728024, -0.759404916654707, -0.717911923064442, -0.673695643646558, -0.626923805894107, -0.577773831408251, -0.526432162877356, -0.473093556836011, -0.417960344886784, -0.361241666187154, -0.303152674113045, -0.243913720108378, -0.183749517816571, -0.122888290664715, -0.0615609061339428, -1.83697019872103e-16, -0, -0], "y": [0, 0.5, 0.445738355776539, 0.38978587329268, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633023, 0.0307950585561708, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072082, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.499999999999999, -0.552364972960505, -0.602634636379256, -0.650618300204242, -0.696133945962926, -0.739008917220659, -0.77908057452567, -0.816196912356222, -0.850217135729614, -0.881012194285784, -0.908465271819523, -0.932472229404355, -0.952942000427156, -0.969796936035009, -0.982973099683902, -0.992420509671936, -0.998103328737044, -1, 0, 0], "name": "Expenses", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585724, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101715, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043864, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728689, 0.992114701314478, 0.998026728428272, 1, 0.998026728428272, 0.992114701314478, 0.982287250728689, 0.968583161128631, 0.951056516295154, 0.929776485888252, 0.90482705246602, 0.876306680043863, 0.844327925502015, 0.809016994374948, 0.77051324277579, 0.728968627421412, 0.684547105928689, 0.63742398974869, 0.587785252292473, 0.535826794978997, 0.481753674101716, 0.425779291565073, 0.368124552684678, 0.309016994374948, 0.248689887164855, 0.187381314585726, 0.125333233564305, 0.0627905195293133, 3.06161699786838e-16, -0, -0], "y": [-0, -1, -0.998026728428272, -0.992114701314478, -0.982287250728689, -0.968583161128631, -0.951056516295154, -0.929776485888252, -0.90482705246602, -0.876306680043864, -0.844327925502015, -0.809016994374948, -0.77051324277579, -0.728968627421412, -0.684547105928689, -0.63742398974869, -0.587785252292473, -0.535826794978997, -0.481753674101715, -0.425779291565073, -0.368124552684678, -0.309016994374948, -0.248689887164855, -0.187381314585725, -0.125333233564305, -0.0627905195293133, -2.44929359829471e-16, 0.0627905195293128, 0.125333233564304, 0.187381314585725, 0.248689887164855, 0.309016994374947, 0.368124552684677, 0.425779291565073, 0.481753674101716, 0.535826794978997, 0.587785252292473, 0.637423989748689, 0.684547105928689, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043863, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728688, 0.992114701314478, 0.998026728428272, 1, -0, -0], "name": "Profit", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "middle", "text": "Profit", "x": 1.1, "y": -2.69422295812418e-16, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 14}}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "Expenses", "x": -0.952627944162883, "y": -0.549999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "Taxes", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7506692"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Format for Percentage Labels</h2> <p>Create a pie chart, and specify a format expression to display each label with three digits after the decimal point. To include a percent sign in the labels, specify <code>'%%'</code> at the end of the expression.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">/</span><span class="mi">3</span> <span class="mi">2</span><span class="p">/</span><span class="mi">3</span><span class="p">];</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="s1">'%.3f%%'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7692271" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7692271" )) { Plotly.newPlot("plot-7692271", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, -0.895163291355062, -0.920905517944954, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295035, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355062, -0.866025403784439, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0.445738355776538, 0.389785873292679, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633018, 0.0307950585561704, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072083, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.5, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784439, -0.833094188154092, -0.796907753204605, -0.757607493251067, -0.715346969520128, -0.670291310127242, -0.62261656485763, -0.572509017272072, -0.520164456825418, -0.465787413841898, -0.409590360336507, -0.351792879805145, -0.29262080922747, -0.232305356634984, -0.17108219769235, -0.10919055482196, -0.0468722624699399, 0.0156291778340073, 0.0780695489307145, 0.140204872281885, 0.201792361288057, 0.262591369949198, 0.322364333161153, 0.380877694973856, 0.437902821184226, 0.493216892697907, 0.546603776169149, 0.597854868516889, 0.646769912017198, 0.693157776787212, 0.736837207603065, 0.777637532133751, 0.815399327823541, 0.849975044817204, 0.881229582494028, 0.909040817357892, 0.933300080220719, 0.953912580814779, 0.970797778174713, 0.983889695342049, 0.993137177162554, 0.998504090169083, 0.999969463768933, 0.99752757218401, 0.991187956823649, 0.980975389002654, 0.966929773150251, 0.949105990888135, 0.927573686586878, 0.902416995238589, 0.873734213709153, 0.841637416654579, 0.80625201860223, 0.767716283908037, 0.7261807865045, 0.681807821550438, 0.634770771281403, 0.585253427538613, 0.533449273623571, 0.479560728284399, 0.423798354787967, 0.366380038168247, 0.307530133865704, 0.247478591084329, 0.186460054291682, 0.124712946372733, 0.0624785370199831, 3.06161699786838e-16, -0, -0], "y": [-0, -0.5, -0.553131154125199, -0.604101012151435, -0.652710415245409, -0.698769427778842, -0.742098079480001, -0.782527068646756, -0.819898423673424, -0.854066120306571, -0.884896652217917, -0.912269552664896, -0.936077865200541, -0.956228561593441, -0.972642905324813, -0.985256759242359, -0.994020836168776, -0.998900891485711, -0.999877856940653, -0.996947915153924, -0.990122514534651, -0.979428324547432, -0.96490713150448, -0.946615675290434, -0.924625427657818, -0.899022312959415, -0.86990637240879, -0.837391373180801, -0.801604363879497, -0.762685178110382, -0.720785888096743, -0.676070210475005, -0.628712866590886, -0.578898899795912, -0.526822952411901, -0.472688505188566, -0.416707082225987, -0.359097424468625, -0.300084635000341, -0.239899299480098, -0.17877658515513, -0.116955321972084, -0.054677069376587, 0.00781482755238294, 0.0702761889452923, 0.132462954246687, 0.194132135853627, 0.255042768561676, 0.31495685110861, 0.37364027613686, 0.43086374494097, 0.48640366342581, 0.540043015774676, 0.591572212413522, 0.640789908958025, 0.687503792943505, 0.731531335263669, 0.772700503382011, 0.810850433529085, 0.845832059259097, 0.87750869390983, 0.90575656468999, 0.930465296307087, 0.951538342246145, 0.968893362014064, 0.982462542875576, 0.992192864823685, 0.998046307749216, 1, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": false}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "66.667%", "x": 0.952627944162882, "y": -0.55, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "33.333%", "x": -0.952627944162882, "y": 0.55, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7692271"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Plot Partial Pie Chart</h2> <p>Create a pie chart of vector <code>X</code> where the sum of the elements is less than 1.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.19</span> <span class="mf">0.22</span> <span class="mf">0.41</span><span class="p">];</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7833560" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7833560" )) { Plotly.newPlot("plot-7833560", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0627905195293134, -0.125333233564304, -0.187381314585725, -0.248689887164855, -0.309016994374947, -0.368124552684678, -0.425779291565073, -0.481753674101715, -0.535826794978996, -0.587785252292473, -0.637423989748689, -0.684547105928689, -0.728968627421411, -0.770513242775789, -0.809016994374947, -0.844327925502015, -0.876306680043864, -0.904827052466019, -0.929776485888251, 0, 0], "y": [0, 1, 0.998026728428272, 0.992114701314478, 0.982287250728689, 0.968583161128631, 0.951056516295154, 0.929776485888251, 0.904827052466019, 0.876306680043864, 0.844327925502015, 0.809016994374947, 0.770513242775789, 0.728968627421411, 0.684547105928689, 0.63742398974869, 0.587785252292473, 0.535826794978997, 0.481753674101715, 0.425779291565073, 0.368124552684678, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.929776485888251, -0.951056516295154, -0.968583161128631, -0.982287250728689, -0.992114701314478, -0.998026728428272, -1, -0.998026728428272, -0.992114701314478, -0.982287250728689, -0.968583161128631, -0.951056516295154, -0.929776485888251, -0.904827052466019, -0.876306680043864, -0.844327925502015, -0.809016994374947, -0.770513242775789, -0.728968627421412, -0.684547105928689, -0.63742398974869, -0.587785252292473, -0.535826794978997, -0, -0], "y": [0, 0.368124552684678, 0.309016994374948, 0.248689887164855, 0.187381314585725, 0.125333233564305, 0.0627905195293136, 1.22464679914735e-16, -0.0627905195293133, -0.125333233564304, -0.187381314585724, -0.248689887164855, -0.309016994374947, -0.368124552684678, -0.425779291565073, -0.481753674101715, -0.535826794978996, -0.587785252292473, -0.63742398974869, -0.684547105928689, -0.728968627421411, -0.770513242775789, -0.809016994374947, -0.844327925502015, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(16.269,189.873,185.946)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.535826794978997, -0.481753674101716, -0.425779291565073, -0.368124552684679, -0.309016994374948, -0.248689887164855, -0.187381314585725, -0.125333233564305, -0.0627905195293141, -1.83697019872103e-16, 0.0627905195293128, 0.125333233564303, 0.187381314585724, 0.248689887164854, 0.309016994374947, 0.368124552684677, 0.425779291565072, 0.481753674101715, 0.535826794978996, 0.587785252292473, 0.637423989748689, 0.684547105928688, 0.728968627421411, 0.770513242775789, 0.809016994374947, 0.844327925502015, 0.876306680043863, 0.904827052466019, 0.929776485888251, 0.951056516295154, 0.968583161128631, 0.982287250728688, 0.992114701314478, 0.998026728428272, 1, 0.998026728428272, 0.992114701314478, 0.982287250728689, 0.968583161128631, 0.951056516295154, 0.929776485888252, 0.90482705246602, -0, -0], "y": [-0, -0.844327925502015, -0.876306680043863, -0.904827052466019, -0.929776485888251, -0.951056516295154, -0.968583161128631, -0.982287250728688, -0.992114701314478, -0.998026728428272, -1, -0.998026728428272, -0.992114701314478, -0.982287250728689, -0.968583161128631, -0.951056516295154, -0.929776485888252, -0.90482705246602, -0.876306680043864, -0.844327925502016, -0.809016994374948, -0.77051324277579, -0.728968627421412, -0.684547105928689, -0.63742398974869, -0.587785252292473, -0.535826794978997, -0.481753674101716, -0.425779291565074, -0.368124552684679, -0.309016994374948, -0.248689887164855, -0.187381314585726, -0.125333233564305, -0.0627905195293142, -2.44929359829471e-16, 0.0627905195293128, 0.125333233564303, 0.187381314585724, 0.248689887164854, 0.309016994374947, 0.368124552684677, 0.425779291565072, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": false}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "41%", "x": 0.727443051856016, "y": -0.825122176593506, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "middle", "text": "22%", "x": -1.04616216792467, "y": -0.339918693812442, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "19%", "x": -0.618291715637344, "y": 0.909788631702018, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7833560"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p><code>pie</code> draws a partial pie because the sum of the elements is less than 1.</p> <h2>Compare Two Pie Charts</h2> <p>Create vectors <code>y2010</code> and <code>y2011</code>, that contain financial data for two years. Then create a cell array containing the labels for the values.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y2010</span> <span class="o">=</span> <span class="p">[</span><span class="mi">50</span> <span class="mi">0</span> <span class="mi">100</span> <span class="mi">95</span><span class="p">];</span> <span class="n">y2011</span> <span class="o">=</span> <span class="p">[</span><span class="mi">65</span> <span class="mi">22</span> <span class="mi">97</span> <span class="mi">120</span><span class="p">];</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Investments'</span><span class="p">,</span><span class="s1">'Cash'</span><span class="p">,</span><span class="s1">'Operations'</span><span class="p">,</span><span class="s1">'Sales'</span><span class="p">};</span> </code></pre></div> <p>Create a 1-by-2 tiled chart layout, and display two pie charts that each have a title. Then display a shared legend in the east tile of the layout. To do this, call the <code>legend</code> function with a return argument to store the legend object. Then move the legend to the east tile by setting the <code>Layout.Tile</code> property to <code>'east'</code>.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y2010</span> <span class="o">=</span> <span class="p">[</span><span class="mi">50</span> <span class="mi">0</span> <span class="mi">100</span> <span class="mi">95</span><span class="p">];</span> <span class="n">y2011</span> <span class="o">=</span> <span class="p">[</span><span class="mi">65</span> <span class="mi">22</span> <span class="mi">97</span> <span class="mi">120</span><span class="p">];</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Investments'</span><span class="p">,</span><span class="s1">'Cash'</span><span class="p">,</span><span class="s1">'Operations'</span><span class="p">,</span><span class="s1">'Sales'</span><span class="p">};</span> <span class="n">t</span> <span class="o">=</span> <span class="n">tiledlayout</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="s1">'TileSpacing'</span><span class="p">,</span><span class="s1">'compact'</span><span class="p">);</span> <span class="c1">% Create pie charts</span> <span class="n">ax1</span> <span class="o">=</span> <span class="n">nexttile</span><span class="p">;</span> <span class="nb">pie</span><span class="p">(</span><span class="n">ax1</span><span class="p">,</span><span class="n">y2010</span><span class="p">)</span> <span class="nb">title</span><span class="p">(</span><span class="s1">'2010'</span><span class="p">)</span> <span class="n">ax2</span> <span class="o">=</span> <span class="n">nexttile</span><span class="p">;</span> <span class="nb">pie</span><span class="p">(</span><span class="n">ax2</span><span class="p">,</span><span class="n">y2011</span><span class="p">)</span> <span class="nb">title</span><span class="p">(</span><span class="s1">'2011'</span><span class="p">)</span> <span class="c1">% Create legend</span> <span class="n">lgd</span> <span class="o">=</span> <span class="nb">legend</span><span class="p">(</span><span class="n">labels</span><span class="p">);</span> <span class="n">lgd</span><span class="o">.</span><span class="n">Layout</span><span class="o">.</span><span class="n">Tile</span> <span class="o">=</span> <span class="s1">'east'</span><span class="p">;</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-7975629" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-7975629" )) { Plotly.newPlot("plot-7975629", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0610231448524026, -0.121818838296015, -0.182160476701088, -0.241823148836038, -0.300584474178487, -0.358225431793611, -0.414531176690295, -0.46929184061231, -0.522303314279718, -0.573368008164859, -0.622295588967282, -0.668903689042559, -0.713018586140736, -0.754475850920814, -0.793120959827811, -0.828809871048002, -0.861409561395595, -0.890798522129708, -0.91686721185358, -0.939518464807934, -0.958667853036661, 0, 0], "y": [0, 1, 0.998136351302928, 0.992552351584645, 0.98326881407275, 0.970320341272419, 0.953755195992579, 0.933635121456065, 0.910035111164267, 0.883043129374047, 0.852759783228795, 0.819297947765685, 0.78278234519684, 0.743349080032561, 0.701145131779339, 0.656327807103518, 0.609064153502577, 0.55953033666942, 0.50791098387045, 0.454398495784844, 0.399192329369996, 0.342498254426125, 0.284527586631032, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.958667853036661, -0.958667853036661, -0, -0], "y": [0, 0.284527586631032, 0.284527586631032, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.958667853036661, -0.974578751102798, -0.986677804559808, -0.994917690693501, -0.99926618105081, -0.99970626749411, -0.9962362287247, -0.988869637015281, -0.977635305125071, -0.96257717360521, -0.943754138935221, -0.921239823162734, -0.895122285947484, -0.865503680135841, -0.832499852213033, -0.796239889195789, -0.756865613737639, -0.714531029421643, -0.669401718410166, -0.621654193807665, -0.57147520926955, -0.519061028557458, -0.46461665789789, -0.408355044146662, -0.3504962418954, -0.291266552777708, -0.230897640341461, -0.169625623949172, -0.107690155250451, -0.0453334808387129, 0.017200505241633, 0.0796672154316464, 0.141822325306833, 0.203422729196931, 0.264227491038828, 0.323998786743525, 0.382502834391341, 0.439510808617075, 0.494799735608727, 0.548153365219183, 0.59936301677982, 0.648228395307789, -0, -0], "y": [0, 0.284527586631032, 0.224045213961181, 0.16268653905298, 0.100691552501247, 0.0383027336900351, -0.0242358976106916, -0.0866797356732627, -0.148784545532343, -0.210307418254823, -0.271007721023231, -0.330648038316637, -0.388995100507827, -0.445820696244747, -0.500902565047651, -0.554025266630754, -0.604981023548241, -0.653570533868799, -0.6996037507001, -0.742900625514285, -0.783291812367104, -0.820619330256316, -0.854737181028691, -0.885511920418802, -0.912823179986123, -0.936564137908985, -0.956641936794008, -0.972978046866806, -0.985508573123468, -0.994184505241423, -0.998971909272251, -0.999852060366649, -0.996821516012454, -0.989892129499252, -0.979091003556907, -0.964460384349366, -0.946057496238323, -0.923954317963064, -0.898237301111886, -0.86900703198624, -0.83637783818014, -0.800477341413605, -0.761445958369134, 0, 0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": false}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.648228395307789, 0.694500679072924, 0.73806353868747, 0.778747024333571, 0.816392419365065, 0.85085285950157, 0.881993905783473, 0.909694069052571, 0.933845283912246, 0.954353330318113, 0.971138201154431, 0.984134414362247, 0.993291268401605, 0.998573040051166, 0.999959123773604, 0.997444112103059, 0.991037816741037, 0.980765230278465, 0.96666642869322, 0.948796415003527, 0.927224904687173, 0.902036053703647, 0.873328130180307, 0.841213131043365, 0.805816345089331, 0.767275864201493, 0.725742044618282, 0.681376920355264, 0.634353571069156, 0.584855446829966, 0.533075652435521, 0.479216194060433, 0.423487191178528, 0.366106056833229, 0.307296649453863, 0.247288399526874, 0.186315414529023, 0.124615565614458, 0.062429559618712, -5.82016719913287e-16, 0, 0], "y": [-0, -0.761445958369134, -0.719492047744273, -0.674731215270295, -0.627338084362498, -0.57749754770324, -0.525404045928465, -0.471260809065229, -0.415279063679564, -0.357677208827815, -0.298679964026257, -0.238517492562992, -0.177424503572298, -0.115639336374482, -0.0534030306534484, 0.00904161390054433, 0.0714509848143512, 0.133581607226288, 0.195191093743618, 0.256039090057547, 0.315888212626641, 0.374504974770514, 0.431660697560887, 0.487132401956355, 0.540703678700468, 0.592165532589386, 0.641317197815443, 0.687966921205719, 0.731932710300049, 0.773043043349987, 0.811137538468859, 0.846067579322387, 0.877696894918874, 0.905902091237084, 0.930573132617756, 0.951613771040767, 0.968941921613178, 0.982489982803325, 0.992205100171627, 0.99804937256922, 1, -0, -0], "name": "", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": false}, {"xaxis": "x2", "yaxis": "y2", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0610277013174738, -0.121827900240733, -0.182173942471399, -0.241840866741187, -0.300606243434796, -0.358251003775161, -0.414560256479989, -0.469324088845212, -0.522338349269007, -0.573405408299279, -0.622334895367516, -0.668944408462574, -0.71306019409885, -0.754517795044001, -0.793162663391588, -0.82885073669319, -0.861448975002265, -0.890835856827712, -0.91690183214832, -0.939549730799311, -0.958695124708585, -0.974266642632287, 0, 0], "y": [0, 1, 0.998136072723507, 0.99255123934381, 0.983266319307454, 0.970315925445868, 0.953748334943773, 0.933625309368855, 0.910021864433622, 0.883025990347743, 0.85273832380334, 0.81927177281604, 0.782751095820315, 0.74331243658818, 0.701102816705018, 0.656279587494491, 0.60900984343569, 0.559469799259223, 0.507844133044329, 0.454325297765859, 0.399112803857574, 0.342412475466274, 0.284435683169308, 0.225398556015806, 0, 0], "name": "Investments", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "scatter", "x": [-0, -0.974266642632287, -0.985497664274326, -0.993545832519136, -0.998385154266412, -1, -0.998385154266413, -0.993545832519136, -0.985497664274326, -0.974266642632288, -0, -0], "y": [0, 0.225398556015806, 0.169688991127439, 0.113431383152355, 0.0568074268069927, 1.22464679914735e-16, -0.0568074268069925, -0.113431383152354, -0.169688991127439, -0.225398556015806, 0, 0], "name": "Cash", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "scatter", "x": [-0, -0.974266642632288, -0.958242987700388, -0.938459316961313, -0.914993258861771, -0.887936891038142, -0.857396379016298, -0.823491559632443, -0.786355470809587, -0.746133829534741, -0.702984460085174, -0.657076674747313, -0.608590609458243, -0.557716516976663, -0.504654020356809, -0.449611329654607, -0.392804424939586, -0.334456208818317, -0.274795631794744, -0.214056793899394, -0.15247802611254, -0.0903009551856793, -0.0277695555308669, 0.0348708081018659, 0.0973743434025848, 0.159495794957211, 0.220991406596581, 0.281619877862666, 0.341143310838912, 0.399328143629474, 0.455946066824486, 0.510774919355288, 0.563599560224398, 0.614212712689668, -0, -0], "y": [-0, -0.225398556015806, -0.285955200202819, -0.345389794881819, -0.403469126746416, -0.459965300358101, -0.514656632377103, -0.567328521417817, -0.617774290115599, -0.665795996100775, -0.711205208697713, -0.753823748301294, -0.793484385529573, -0.830031497409237, -0.863321678019097, -0.893224301195515, -0.919622033091792, -0.942411292580304, -0.961502657690829, -0.97682121649026, -0.98830686102689, -0.995914523185878, -0.999614351530438, -0.999391828434835, -0.995247827049582, -0.987198607875319, -0.975275754958804, -0.959526051961393, -0.940011298586281, -0.91680806808483, -0.890007406793495, -0.859714476880318, -0.826048143702814, -0.789140509396394, -0, -0], "name": "Operations", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "scatter", "x": [0, 0.614212712689668, 0.661931782259567, 0.707106781186547, 0.749564083741126, 0.789140509396393, 0.825683949996556, 0.859053954369885, 0.889122268139185, 0.915773326655057, 0.938904699157429, 0.958427482458253, 0.974266642632287, 0.986361303402722, 0.994664980113243, 0.999145758387301, 0.999786416787931, 0.99658449300667, 0.989552293327203, 0.978716845327354, 0.964119794001214, 0.945817241700635, 0.923879532511287, 0.898390981891979, 0.869449552616367, 0.837166478262529, 0.801665835697489, 0.763084068199807, 0.721569461053062, 0.677281571625742, 0.630390616127955, 0.581076815401938, 0.529529702260709, 0.475947393037073, 0.420535826142708, 0.363507970563831, 0.305083007335548, 0.245485487140799, 0.184944467271559, 0.123692631269348, 0.0619653946285945, 3.06161699786838e-16, 0, 0], "y": [-0, -0.789140509396394, -0.749564083741126, -0.707106781186548, -0.661931782259566, -0.614212712689668, -0.564132976095251, -0.511885049089601, -0.457669741515682, -0.40169542465297, -0.344177230362639, -0.285336224249105, -0.225398556015806, -0.164594590280734, -0.103158021192357, -0.0413249742488131, 0.0206669012275539, 0.0825793454723323, 0.144174404007346, 0.205215342195634, 0.265467555108072, 0.324699469204683, 0.38268343236509, 0.43919658884737, 0.494021735812504, 0.546948158122427, 0.597772438203241, 0.64629923786094, 0.69234204904483, 0.735723910673131, 0.776278088765757, 0.813848717270195, 0.848291397117574, 0.879473751206489, 0.90727593318156, 0.931591088051279, 0.952325762874815, 0.96940026593933, 0.982748973047359, 0.992320579737045, 0.998078298465868, 1, -0, -0], "name": "Sales", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": true, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 2.4525, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.421964285714286], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.421964285714286], "y": [0.322857142857143, 0.712142857142857]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 2.4525, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.322857142857143, 0.712142857142857], "anchor": "x1"}, "xaxis2": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 2.4525, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.491964285714286, 0.783928571428571], "anchor": "y2"}, "scene2": {"domain": {"x": [0.491964285714286, 0.783928571428571], "y": [0.322857142857143, 0.712142857142857]}}, "yaxis2": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 2.4525, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.322857142857143, 0.712142857142857], "anchor": "x2"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b>2010<\/b>", "x": 0.275982142857143, "y": 0.722142857142857, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b>2011<\/b>", "x": 0.637946428571429, "y": 0.722142857142857, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "middle", "text": "39%", "x": 1.03231526425474, "y": 0.379901559863439, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "41%", "x": -0.600088391331603, "y": -0.921896915381025, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "middle", "text": "0%", "x": -1.05453463834033, "y": 0.312980345294136, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "20%", "x": -0.657921583540338, "y": 0.881554984054752, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x2", "yref": "y2", "xanchor": "left", "align": "left", "yanchor": "middle", "text": "39%", "x": 1.0403989658707, "y": 0.357169416125152, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x2", "yref": "y2", "xanchor": "center", "align": "center", "yanchor": "top", "text": "32%", "x": -0.367901829700148, "y": -1.03665242183833, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x2", "yref": "y2", "xanchor": "right", "align": "right", "yanchor": "middle", "text": "7%", "x": -1.1, "y": 1.34711147906209e-16, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x2", "yref": "y2", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "21%", "x": -0.684568384904267, "y": 0.861026205402346, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "paper", "yref": "paper", "align": "center", "xanchor": "center", "yanchor": "bottom", "text": "", "x": 0.5, "y": 0.95, "font": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 15.6, "family": "Arial, sans-serif"}, "textangle": 0}], "legend": {"x": 0.8125, "xref": "paper", "xanchor": "left", "y": 0.453809523809524, "yref": "paper", "yanchor": "bottom", "traceorder": "normal", "borderwidth": 0.5, "bordercolor": "rgb(38.25,38.25,38.25)", "bgcolor": "rgb(255,255,255)", "font": {"size": 9, "family": "Arial, sans-serif", "color": "rgb(0,0,0_)"}}, "title": "<b>2010<\/b>", "titlefont": {"color": "rgba(0,0,0,0)"}}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-7975629"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Plot Categorical Pie Chart with Offsets</h2> <p>Plot a categorical pie chart with offset slices corresponding to categories.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="nb">categorical</span><span class="p">({</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'East'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'West'</span><span class="p">});</span> <span class="n">explode</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">};</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">explode</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-8144744" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-8144744" )) { Plotly.newPlot("plot-8144744", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "East", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0.0866025403784439, -0.952627944162882, -0.981765831733506, -1.0075080583234, -1.02975697484972, -1.04842818355126, -1.06345085813804, -1.0747680124597, -1.08233671667348, -1.08612826009181, -1.08612826009181, -1.08233671667348, -1.0747680124597, -1.06345085813804, -1.04842818355126, -1.02975697484972, -1.0075080583234, -0.981765831733507, -0.952627944162883, -0.920204925599564, -0.884619767658684, -0.846007457033151, -0.804514463442886, -0.760298184025002, -0.713526346272551, -0.664376371786695, -0.6130347032558, -0.559696097214454, -0.504562885265228, -0.447844206565598, -0.389755214491488, -0.330516260486821, -0.270352058195015, -0.209490831043159, -0.148163446512387, -0.0866025403784441, -0.0866025403784439, -0.0866025403784439], "y": [-0.0499999999999999, 0.45, 0.395738355776539, 0.33978587329268, 0.28235479947966, 0.223662990072083, 0.163933083206498, 0.103391654878686, 0.0422683594633024, -0.0192049414438291, -0.0807950585561701, -0.142268359463302, -0.203391654878685, -0.263933083206497, -0.323662990072082, -0.382354799479659, -0.439785873292679, -0.495738355776538, -0.549999999999999, -0.602364972960505, -0.652634636379256, -0.700618300204242, -0.746133945962926, -0.789008917220659, -0.82908057452567, -0.866196912356222, -0.900217135729614, -0.931012194285784, -0.958465271819523, -0.982472229404355, -1.00294200042716, -1.01979693603501, -1.0329730996839, -1.04242050967194, -1.04810332873704, -1.05, -0.0499999999999999, -0.0499999999999999], "name": "North", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0.0866025403784438, 0.0866025403784437, 0.148163446512386, 0.209490831043157, 0.270352058195014, 0.330516260486821, 0.389755214491487, 0.447844206565596, 0.504562885265227, 0.559696097214454, 0.6130347032558, 0.664376371786695, 0.71352634627255, 0.760298184025001, 0.804514463442885, 0.846007457033151, 0.884619767658683, 0.920204925599563, 0.952627944162882, 0.981765831733506, 1.0075080583234, 1.02975697484972, 1.04842818355126, 1.06345085813804, 1.0747680124597, 1.08233671667348, 1.08612826009181, 1.08612826009181, 1.08233671667348, 1.0747680124597, 1.06345085813804, 1.04842818355126, 1.02975697484972, 1.0075080583234, 0.981765831733507, 0.952627944162883, 0.0866025403784438, 0.0866025403784438], "y": [-0.05, -1.05, -1.04810332873704, -1.04242050967194, -1.0329730996839, -1.01979693603501, -1.00294200042716, -0.982472229404356, -0.958465271819524, -0.931012194285785, -0.900217135729614, -0.866196912356222, -0.829080574525671, -0.789008917220659, -0.746133945962927, -0.700618300204242, -0.652634636379257, -0.602364972960506, -0.55, -0.495738355776538, -0.439785873292679, -0.38235479947966, -0.323662990072083, -0.263933083206498, -0.203391654878686, -0.142268359463302, -0.0807950585561706, -0.01920494144383, 0.0422683594633014, 0.103391654878685, 0.163933083206497, 0.223662990072083, 0.282354799479659, 0.339785873292679, 0.395738355776538, 0.449999999999999, -0.05, -0.05], "name": "South", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.866025403784439, 0.83360238522112, 0.79801722728024, 0.759404916654707, 0.717911923064442, 0.673695643646558, 0.626923805894107, 0.577773831408252, 0.526432162877356, 0.473093556836011, 0.417960344886784, 0.361241666187154, 0.303152674113045, 0.243913720108378, 0.183749517816571, 0.122888290664715, 0.0615609061339439, 1.19434011948696e-15, 0, 0], "y": [0, 0.499999999999999, 0.552364972960505, 0.602634636379255, 0.650618300204242, 0.696133945962926, 0.739008917220659, 0.77908057452567, 0.816196912356221, 0.850217135729614, 0.881012194285784, 0.908465271819523, 0.932472229404355, 0.952942000427156, 0.969796936035009, 0.982973099683902, 0.992420509671936, 0.998103328737044, 1, 0, 0], "name": "West", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "West (17%)", "x": 0.550000000000001, "y": 0.952627944162882, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "South (33%)", "x": 1.03923048454133, "y": -0.600000000000001, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "North (33%)", "x": -1.03923048454133, "y": -0.599999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "East (17%)", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-8144744"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Now, use a logical vector to offset the same slices.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="nb">categorical</span><span class="p">({</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'East'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'West'</span><span class="p">});</span> <span class="n">explode</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span><span class="p">];</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">explode</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-8297214" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-8297214" )) { Plotly.newPlot("plot-8297214", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "East", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0.0866025403784439, -0.952627944162882, -0.981765831733506, -1.0075080583234, -1.02975697484972, -1.04842818355126, -1.06345085813804, -1.0747680124597, -1.08233671667348, -1.08612826009181, -1.08612826009181, -1.08233671667348, -1.0747680124597, -1.06345085813804, -1.04842818355126, -1.02975697484972, -1.0075080583234, -0.981765831733507, -0.952627944162883, -0.920204925599564, -0.884619767658684, -0.846007457033151, -0.804514463442886, -0.760298184025002, -0.713526346272551, -0.664376371786695, -0.6130347032558, -0.559696097214454, -0.504562885265228, -0.447844206565598, -0.389755214491488, -0.330516260486821, -0.270352058195015, -0.209490831043159, -0.148163446512387, -0.0866025403784441, -0.0866025403784439, -0.0866025403784439], "y": [-0.0499999999999999, 0.45, 0.395738355776539, 0.33978587329268, 0.28235479947966, 0.223662990072083, 0.163933083206498, 0.103391654878686, 0.0422683594633024, -0.0192049414438291, -0.0807950585561701, -0.142268359463302, -0.203391654878685, -0.263933083206497, -0.323662990072082, -0.382354799479659, -0.439785873292679, -0.495738355776538, -0.549999999999999, -0.602364972960505, -0.652634636379256, -0.700618300204242, -0.746133945962926, -0.789008917220659, -0.82908057452567, -0.866196912356222, -0.900217135729614, -0.931012194285784, -0.958465271819523, -0.982472229404355, -1.00294200042716, -1.01979693603501, -1.0329730996839, -1.04242050967194, -1.04810332873704, -1.05, -0.0499999999999999, -0.0499999999999999], "name": "North", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0.0866025403784438, 0.0866025403784437, 0.148163446512386, 0.209490831043157, 0.270352058195014, 0.330516260486821, 0.389755214491487, 0.447844206565596, 0.504562885265227, 0.559696097214454, 0.6130347032558, 0.664376371786695, 0.71352634627255, 0.760298184025001, 0.804514463442885, 0.846007457033151, 0.884619767658683, 0.920204925599563, 0.952627944162882, 0.981765831733506, 1.0075080583234, 1.02975697484972, 1.04842818355126, 1.06345085813804, 1.0747680124597, 1.08233671667348, 1.08612826009181, 1.08612826009181, 1.08233671667348, 1.0747680124597, 1.06345085813804, 1.04842818355126, 1.02975697484972, 1.0075080583234, 0.981765831733507, 0.952627944162883, 0.0866025403784438, 0.0866025403784438], "y": [-0.05, -1.05, -1.04810332873704, -1.04242050967194, -1.0329730996839, -1.01979693603501, -1.00294200042716, -0.982472229404356, -0.958465271819524, -0.931012194285785, -0.900217135729614, -0.866196912356222, -0.829080574525671, -0.789008917220659, -0.746133945962927, -0.700618300204242, -0.652634636379257, -0.602364972960506, -0.55, -0.495738355776538, -0.439785873292679, -0.38235479947966, -0.323662990072083, -0.263933083206498, -0.203391654878686, -0.142268359463302, -0.0807950585561706, -0.01920494144383, 0.0422683594633014, 0.103391654878685, 0.163933083206497, 0.223662990072083, 0.282354799479659, 0.339785873292679, 0.395738355776538, 0.449999999999999, -0.05, -0.05], "name": "South", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.866025403784439, 0.83360238522112, 0.79801722728024, 0.759404916654707, 0.717911923064442, 0.673695643646558, 0.626923805894107, 0.577773831408252, 0.526432162877356, 0.473093556836011, 0.417960344886784, 0.361241666187154, 0.303152674113045, 0.243913720108378, 0.183749517816571, 0.122888290664715, 0.0615609061339439, 1.19434011948696e-15, 0, 0], "y": [0, 0.499999999999999, 0.552364972960505, 0.602634636379255, 0.650618300204242, 0.696133945962926, 0.739008917220659, 0.77908057452567, 0.816196912356221, 0.850217135729614, 0.881012194285784, 0.908465271819523, 0.932472229404355, 0.952942000427156, 0.969796936035009, 0.982973099683902, 0.992420509671936, 0.998103328737044, 1, 0, 0], "name": "West", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "West (17%)", "x": 0.550000000000001, "y": 0.952627944162882, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "South (33%)", "x": 1.03923048454133, "y": -0.600000000000001, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "North (33%)", "x": -1.03923048454133, "y": -0.599999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "East (17%)", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-8297214"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Plot Categorical Pie Chart with Labels</h2> <p>Plot a categorical pie chart without any offset slices and label the slices. When <code>X</code> is of data type <code>categorical</code> you must specify the input argument <code>explode</code>. To specify labels without any offset slices, specify <code>explode</code> as an empty cell array, and <code>labels</code> as the labels.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="nb">categorical</span><span class="p">({</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'East'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'West'</span><span class="p">});</span> <span class="n">explode</span> <span class="o">=</span> <span class="p">{};</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'E'</span><span class="p">,</span><span class="s1">'N'</span><span class="p">,</span><span class="s1">'S'</span><span class="p">,</span><span class="s1">'W'</span><span class="p">};</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">explode</span><span class="p">,</span><span class="n">labels</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-8436158" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-8436158" )) { Plotly.newPlot("plot-8436158", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "East", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784438, -0.895163291355062, -0.920905517944953, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295034, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355063, -0.866025403784439, -0.83360238522112, -0.79801722728024, -0.759404916654707, -0.717911923064442, -0.673695643646558, -0.626923805894107, -0.577773831408251, -0.526432162877356, -0.473093556836011, -0.417960344886784, -0.361241666187154, -0.303152674113045, -0.243913720108378, -0.183749517816571, -0.122888290664715, -0.0615609061339428, -1.83697019872103e-16, -0, -0], "y": [0, 0.5, 0.445738355776539, 0.38978587329268, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633023, 0.0307950585561708, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072082, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.499999999999999, -0.552364972960505, -0.602634636379256, -0.650618300204242, -0.696133945962926, -0.739008917220659, -0.77908057452567, -0.816196912356222, -0.850217135729614, -0.881012194285784, -0.908465271819523, -0.932472229404355, -0.952942000427156, -0.969796936035009, -0.982973099683902, -0.992420509671936, -0.998103328737044, -1, 0, 0], "name": "North", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0615609061339425, 0.122888290664714, 0.183749517816571, 0.243913720108377, 0.303152674113043, 0.361241666187153, 0.417960344886783, 0.47309355683601, 0.526432162877356, 0.577773831408251, 0.626923805894106, 0.673695643646557, 0.717911923064441, 0.759404916654707, 0.798017227280239, 0.833602385221119, 0.866025403784438, 0.895163291355062, 0.920905517944954, 0.943154434471277, 0.961825643172819, 0.976848317759601, 0.988165472081259, 0.995734176295034, 0.999525719713366, 0.999525719713366, 0.995734176295035, 0.988165472081259, 0.976848317759601, 0.961825643172819, 0.943154434471278, 0.920905517944954, 0.895163291355063, 0.866025403784439, -0, -0], "y": [-0, -1, -0.998103328737044, -0.992420509671936, -0.982973099683902, -0.969796936035009, -0.952942000427157, -0.932472229404356, -0.908465271819524, -0.881012194285784, -0.850217135729614, -0.816196912356222, -0.779080574525671, -0.739008917220659, -0.696133945962927, -0.650618300204242, -0.602634636379257, -0.552364972960506, -0.5, -0.445738355776538, -0.389785873292679, -0.33235479947966, -0.273662990072083, -0.213933083206498, -0.153391654878686, -0.092268359463302, -0.0307950585561705, 0.03079505855617, 0.0922683594633015, 0.153391654878685, 0.213933083206497, 0.273662990072083, 0.332354799479659, 0.389785873292679, 0.445738355776538, 0.499999999999999, -0, -0], "name": "South", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 0.866025403784439, 0.83360238522112, 0.79801722728024, 0.759404916654707, 0.717911923064442, 0.673695643646558, 0.626923805894107, 0.577773831408252, 0.526432162877356, 0.473093556836011, 0.417960344886784, 0.361241666187154, 0.303152674113045, 0.243913720108378, 0.183749517816571, 0.122888290664715, 0.0615609061339439, 1.19434011948696e-15, 0, 0], "y": [0, 0.499999999999999, 0.552364972960505, 0.602634636379255, 0.650618300204242, 0.696133945962926, 0.739008917220659, 0.77908057452567, 0.816196912356221, 0.850217135729614, 0.881012194285784, 0.908465271819523, 0.932472229404355, 0.952942000427156, 0.969796936035009, 0.982973099683902, 0.992420509671936, 0.998103328737044, 1, 0, 0], "name": "West", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "W", "x": 0.550000000000001, "y": 0.952627944162882, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "S", "x": 0.952627944162882, "y": -0.55, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "N", "x": -0.952627944162883, "y": -0.549999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "E", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-8436158"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Now, offset a slice and label all slices.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="nb">categorical</span><span class="p">({</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'North'</span><span class="p">,</span><span class="s1">'East'</span><span class="p">,</span><span class="s1">'South'</span><span class="p">,</span><span class="s1">'West'</span><span class="p">});</span> <span class="n">explode</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'West'</span><span class="p">};</span> <span class="n">labels</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'E'</span><span class="p">,</span><span class="s1">'N'</span><span class="p">,</span><span class="s1">'S'</span><span class="p">,</span><span class="s1">'W'</span><span class="p">};</span> <span class="nb">pie</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">explode</span><span class="p">,</span><span class="n">labels</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-8573546" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-8573546" )) { Plotly.newPlot("plot-8573546", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0, 6.12323399573677e-17, -0.0615609061339428, -0.122888290664714, -0.18374951781657, -0.243913720108377, -0.303152674113043, -0.361241666187153, -0.417960344886783, -0.47309355683601, -0.526432162877356, -0.577773831408251, -0.626923805894106, -0.673695643646557, -0.717911923064442, -0.759404916654707, -0.798017227280239, -0.833602385221119, -0.866025403784438, 0, 0], "y": [0, 1, 0.998103328737044, 0.992420509671936, 0.982973099683902, 0.969796936035009, 0.952942000427157, 0.932472229404356, 0.908465271819524, 0.881012194285785, 0.850217135729614, 0.816196912356222, 0.779080574525671, 0.739008917220659, 0.696133945962927, 0.650618300204242, 0.602634636379256, 0.552364972960506, 0.5, 0, 0], "name": "East", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(61.761,38.352,168.3765)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -0.866025403784438, -0.895163291355062, -0.920905517944953, -0.943154434471277, -0.961825643172819, -0.976848317759601, -0.988165472081259, -0.995734176295034, -0.999525719713366, -0.999525719713366, -0.995734176295035, -0.988165472081259, -0.976848317759601, -0.961825643172819, -0.943154434471278, -0.920905517944954, -0.895163291355063, -0.866025403784439, -0.83360238522112, -0.79801722728024, -0.759404916654707, -0.717911923064442, -0.673695643646558, -0.626923805894107, -0.577773831408251, -0.526432162877356, -0.473093556836011, -0.417960344886784, -0.361241666187154, -0.303152674113045, -0.243913720108378, -0.183749517816571, -0.122888290664715, -0.0615609061339428, -1.83697019872103e-16, -0, -0], "y": [0, 0.5, 0.445738355776539, 0.38978587329268, 0.33235479947966, 0.273662990072083, 0.213933083206498, 0.153391654878686, 0.0922683594633023, 0.0307950585561708, -0.0307950585561701, -0.0922683594633016, -0.153391654878685, -0.213933083206497, -0.273662990072082, -0.332354799479659, -0.389785873292679, -0.445738355776538, -0.499999999999999, -0.552364972960505, -0.602634636379256, -0.650618300204242, -0.696133945962926, -0.739008917220659, -0.77908057452567, -0.816196912356222, -0.850217135729614, -0.881012194285784, -0.908465271819523, -0.932472229404355, -0.952942000427156, -0.969796936035009, -0.982973099683902, -0.992420509671936, -0.998103328737044, -1, 0, 0], "name": "North", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(39.27,150.501,235.059)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [-0, -1.83697019872103e-16, 0.0615609061339425, 0.122888290664714, 0.183749517816571, 0.243913720108377, 0.303152674113043, 0.361241666187153, 0.417960344886783, 0.47309355683601, 0.526432162877356, 0.577773831408251, 0.626923805894106, 0.673695643646557, 0.717911923064441, 0.759404916654707, 0.798017227280239, 0.833602385221119, 0.866025403784438, 0.895163291355062, 0.920905517944954, 0.943154434471277, 0.961825643172819, 0.976848317759601, 0.988165472081259, 0.995734176295034, 0.999525719713366, 0.999525719713366, 0.995734176295035, 0.988165472081259, 0.976848317759601, 0.961825643172819, 0.943154434471278, 0.920905517944954, 0.895163291355063, 0.866025403784439, -0, -0], "y": [-0, -1, -0.998103328737044, -0.992420509671936, -0.982973099683902, -0.969796936035009, -0.952942000427157, -0.932472229404356, -0.908465271819524, -0.881012194285784, -0.850217135729614, -0.816196912356222, -0.779080574525671, -0.739008917220659, -0.696133945962927, -0.650618300204242, -0.602634636379257, -0.552364972960506, -0.5, -0.445738355776538, -0.389785873292679, -0.33235479947966, -0.273662990072083, -0.213933083206498, -0.153391654878686, -0.092268359463302, -0.0307950585561705, 0.03079505855617, 0.0922683594633015, 0.153391654878685, 0.213933083206497, 0.273662990072083, 0.332354799479659, 0.389785873292679, 0.445738355776538, 0.499999999999999, -0, -0], "name": "South", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(128.622,203.8215,88.74)", "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "scatter", "x": [0.0500000000000001, 0.916025403784439, 0.88360238522112, 0.84801722728024, 0.809404916654707, 0.767911923064442, 0.723695643646558, 0.676923805894107, 0.627773831408252, 0.576432162877356, 0.523093556836011, 0.467960344886784, 0.411241666187154, 0.353152674113045, 0.293913720108379, 0.233749517816571, 0.172888290664715, 0.111560906133944, 0.0500000000000013, 0.0500000000000001, 0.0500000000000001], "y": [0.0866025403784438, 0.586602540378443, 0.638967513338949, 0.689237176757699, 0.737220840582686, 0.78273648634137, 0.825611457599102, 0.865683114904114, 0.902799452734665, 0.936819676108058, 0.967614734664228, 0.995067812197967, 1.0190747697828, 1.0395445408056, 1.05639947641345, 1.06957564006235, 1.07902305005038, 1.08470586911549, 1.08660254037844, 0.0866025403784438, 0.0866025403784438], "name": "West", "visible": true, "fill": "tozeroy", "mode": "lines", "marker": {"sizeref": 1, "sizemode": "diameter", "size": 6, "line": {"width": 0.5}, "color": "rgb(0,0,0)"}, "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}, "fillcolor": "rgb(249.1095,250.8945,20.5275)", "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": false, "tickmode": "array", "tickvals": [-1, -0.5, 0, 0.5, 1], "range": [-1.2, 1.2], "mirror": false, "ticktext": ["-1", "-0.5", "0", "0.5", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": false, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "bottom", "text": "W", "x": 0.600000000000001, "y": 1.03923048454133, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "left", "align": "left", "yanchor": "top", "text": "S", "x": 0.952627944162882, "y": -0.55, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "top", "text": "N", "x": -0.952627944162883, "y": -0.549999999999999, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "right", "align": "right", "yanchor": "bottom", "text": "E", "x": -0.55, "y": 0.952627944162883, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-8573546"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> </section> <!--End Plotly Basics Section--> </section> </div> </main> <script> var array = []; $('.tutorial-content :header:not(h6)').each(function (i, e) { var item = $(e); var itemText = item.text(); var hash = itemText.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/^-+|-+$/g, '').toLowerCase(); item.attr("id", hash); array.push({text: itemText, tag: item.prop("tagName"), hash: hash}); }); $("#nav_header_insertion_list").html(array.map(function(entry) { var text = entry.text.replace(/[^a-z0-9\s\.:\-\?\!\(\))]/gi, ''); if(entry.tag.toLowerCase() < "h4"){ return('<li class="--sidebar-item"><a href="#' + entry.hash + '">' + text + '</a></li>'); } else { return('<li class="--sidebar-item"><a href="#' + entry.hash + '">' + text + '</a></li>'); } }).join("")); //$(".tutorial-content :header:not(h6)").append( "\<div class=\"icon copy\" data-tooltip=\"Click to copy direct link\"><svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\"/> </svg> </div>"); </script> <footer class="--footer-main"> <section class="--footer-top"> <div class="--wrap"> <ul class="--footer-body"> <li class="--footer-column"> <h6 style="color:#119dff" class="--footer-heading">JOIN OUR MAILING LIST</h6>			 <ul> 				 <li> <p class="subscribe-text"> Sign up to stay in the loop with all things Plotly — from Dash Club to product updates, webinars, and more!</p> <a href="https://go.plot.ly/subscription" class="subscribe-button" target="_blank"> Subscribe </a> </li> </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#e763fa" class="--footer-heading">Products</h6>			 <ul> <li><a href="https://plotly.com/dash/" target="_self">Dash</a></li> 				 				 <li><a href="https://plotly.com/consulting-and-oem/" target="_self">Consulting and Training</a></li> </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#636efa" class="--footer-heading">Pricing</h6>			 <ul> <li><a href="https://plotly.com/get-pricing/" target="_self">Enterprise Pricing</a></li> 				 </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#00cc96" class="--footer-heading">About Us</h6>			 <ul> <li><a href="https://plotly.com/careers" target="_self">Careers</a></li> 				 <li><a href="https://plotly.com/resources/" target="_self">Resources</a></li> 				 <li><a href="https://medium.com/@plotlygraphs" target="_self">Blog</a></li> 				 </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#EF553B" class="--footer-heading">Support</h6>			 <ul> <li><a href="https://community.plot.ly/" target="_self">Community Support</a></li> 				 <li><a href="https://plotly.com/graphing-libraries" target="_self">Documentation</a></li> 				 </ul> </li> </ul> </div> </section> <section class="--footer-meta"> <div class="--wrap"> <div class="left"> <article class="--copyright">Copyright © 2024 Plotly. All rights reserved.</article> </div> <div class="right"> <article class="--tos"><a href="https://community.plotly.com/tos" target="_blank">Terms of Service</a> </article> <article class="--privacy"><a href="https://plotly.com/privacy/" target="_blank">Privacy Policy</a> </article> </div> </div> <div id="markprompt" /> </section> </footer> <div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content" id="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <span style="float: left; padding-top:13px; padding-right:10px;"><i class="fa fa-search fa-lg"></i></span> <input id="search-input" class="search-input" type="text" placeholder="" /> </div> <div class="modal-body" id="modal-body"> <div id="search-results" class="search-results"> <div id="primary-search-results" class="primary-search-results"></div> <div id="schema-search-results" class="schema-search-results"></div> </div> </div> </div> </div> </div> <script> window.plotly_doc_language = "matlab"; </script> <!-- ALGOLIA SEARCH --> <script> window.ALGOLIA_CONFIG = { 'applicationId': '7EK9KHJW8M', 'indexName': 'matlab_docs', 'apiKey': '4dae07ded6a721de73bde7356eec9280', 'baseurl': '/' } </script> <script id="algolia__template" type="text/template"> <div class="algolia__result"> <a class="algolia__result-link" onClick="$('#myModal').modal('toggle')" href="/{{ permalink }}">{{{ _highlightResult.name.value }}}</a> <div class="algolia__result-text">{{{ _highlightResult.description.value }}}</div> </div> </script> <script id="algolia__secondary-template" type="text/template"> <div class="algolia__secondary-result"> <a class="algolia__result-link" onClick="$('#myModal').modal('toggle')" href="/{{ permalink }}">{{{ _highlightResult.name.value }}}</a> <div class="algolia__result-text">{{{ _highlightResult.description.value }}}</div> </div> </script> <script id="algolia__template--no-results" type="text/template">No results found.</script> <script src="//cdn.jsdelivr.net/hogan.js/3.0.2/hogan.min.js"></script> <script src="/all_static/javascripts/algolia/algolia.js"></script> <!-- Hash offset Script --> <script src="/all_static//javascripts/hash_offset.js"></script> <!-- Image Hover Script --> <script src="/all_static/javascripts/imghover.js"></script> <script src="/all_static/javascripts/improve.js?version=2024-11-19-16-02"></script> <!-- code highlighting --> <!--<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script> <script src="/all_static/javascripts/highlight.line-numbers.js"></script>--> <script src="/all_static/javascripts/highlight/highlight.min.js"></script> <script src="/all_static/javascripts/highlight/julia.min.js"></script> <script src="/all_static/javascripts/highlight.line-numbers.js"></script> </body> </html>