{"id":472,"date":"2023-11-13T07:55:51","date_gmt":"2023-11-13T12:55:51","guid":{"rendered":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/?p=472"},"modified":"2023-12-15T13:10:11","modified_gmt":"2023-12-15T18:10:11","slug":"pie-charts-and-donut-charts","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2023\/11\/13\/pie-charts-and-donut-charts\/","title":{"rendered":"Guilty pleasures: Pie Charts and Donut Charts"},"content":{"rendered":"<table style=\"background-color: #e2f0ff\">\n<tbody>\n<tr>\n<td style=\"width: 120px;padding: 3px;vertical-align: middle\"><img decoding=\"async\" loading=\"lazy\" width=\"300\" height=\"300\" class=\"alignleft size-medium wp-image-487\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/IMG_6692_AbbyS1-Copy-2-300x300.jpeg\" alt=\"Abby Skofield\" \/><\/td>\n<td style=\"vertical-align: middle;padding: 3px\"><strong>Guest Writer: <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/2918286\">Abby Skofield<\/a><br \/>\n<\/strong>In today's article, Abby Skofield slices through the debate about pie charts and introduces two new delectable desserts recently added to the MATLAB menu. Abby is a software engineer on the MATLAB Charting Team. Abby started her MathWorks career in the User Experience (UX) group, supporting the graphics team in the lead up to the release of the new graphics system in R2014b. Some of us might remember those changes &#x1f609;. In the UX group, Abby had the opportunity to work with hundreds of customers to learn about how they used MATLAB Graphics, their wish lists, and she got to dig in to the technical details with her engineering colleagues. She switched roles in 2020 to join their ranks as a software engineer, where she continues to enjoy learning about customer use cases while also getting hands-on time in the code.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<div class=\"rtcContent\">\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">I've been working with the MATLAB Charting team for 12 years, but you don't need to be surrounded by data viz nerds for that long to have heard the rumors about pie charts. At best, pie charts should be used carefully and sparingly; at worst, they \"<a href=\"https:\/\/twitter.com\/EdwardTufte\/status\/1359920895112978434?lang=en\"><em>subtract from the world's knowledge<\/em><\/a>.\" Pie charts have some haters, including my boss, who wears this shirt around the office sometimes.<\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 368px;height: 354px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_1.png\" alt=\"\" width=\"528\" height=\"507\" \/><br \/>\n<em>Eric Ludlam, development manager of the MATLAB Charting team.\u00a0\u00a0<\/em><\/div>\n<div><\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">And that's why I'm surprised to find myself here today telling you about our brand spanking new <strong><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/piechart.html\"><span style=\"font-family: monospace\">piechart<\/span> <\/a><\/strong>released in R2023b. I have to admit, I find myself drawn back to pie charts again and again. And I know you are too, given the number of bug reports and enhancement requests we get from you about our existing <span style=\"font-family: monospace\">pie<\/span> function.<\/div>\n<h2 id=\"H_7C514CB6\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 20px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">What's wrong with pie charts?<\/h2>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">There are lots of different reasons why pie charts are tricky. They turn into a big mess as soon as you have more than a handful of wedges. They can be misleading if they are used to represent data that aren't parts of a whole (e.g., a pie chart showing the ages of people in your household). And at a basic, perceptual level humans are better at differentiating length (heights of different bars) as opposed to differentiating angle (pie wedges). For example, compare the pie and bar charts below.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">data = [10 11 9.5 16 18 17];<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">tiledlayout <span style=\"color: #a709f5\">horizontal<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">nexttile<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">pie(data)<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">nexttile<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">bar(data, FaceColor = <span style=\"color: #a709f5\">\"flat\"<\/span>, CData = 1:6);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">clim([1 6])<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #008013\">% Axes niceness<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">axis <span style=\"color: #a709f5\">padded square<\/span><\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_0\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 523px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_2.png\" height=\"392\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 id=\"H_E53BD24E\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 20px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">What's wrong with MATLAB's current pie chart?<\/h2>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Unfortunately, MATLAB's current pie chart, created with the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/pie.html\"><span style=\"font-family: monospace\">pie<\/span><\/a> command, is an easy target for the haters not only because it's an empirically bad way to visualize data, but the MATLAB implementation doesn't support many of the programming conventions that MATLAB graphics objects have adopted over the last decade or so. We've heard from customers over and over again, pointing out strange behaviors and asking for simpler workflows and new features. A lot of the pain comes from the fact that <span style=\"font-family: monospace\">pie<\/span> simply creates a bunch of patch and text objects in a Cartesian axes. Internally, we call this a \"bucket of parts\" chart because, well, that's what you get - a bucket of the parts used to cobble it together! (It's MATLAB, so of course your bucket is an array.)<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">bucketOfPieParts = pie([10 11 9.5 16 18 17]);<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">axis <span style=\"color: #a709f5\">on<\/span><\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_1\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 503px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_3.png\" height=\"377\" \/><\/div>\n<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 6px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">bucketOfPieParts<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableStringElement\" style=\"width: 1146px;font-style: normal;font-size: 12px\" data-testid=\"output_2\">\n<div class=\"textElement eoOutputContent\" style=\"max-height: 261px;font-style: normal;font-size: 12px\" data-previous-available-width=\"1109\" data-previous-scroll-height=\"64\" data-hashorizontaloverflow=\"false\">\n<div style=\"font-style: normal;font-size: 12px\"><span class=\"variableNameElement\" style=\"font-style: normal;font-size: 12px\">bucketOfPieParts = <\/span><\/div>\n<div style=\"font-style: normal;font-size: 12px\">\n<p>1\u00d712 graphics array:<\/p>\n<p>Patch Text Patch Text Patch Text Patch Text Patch Text Patch Text<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"margin: 10px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">There is no easy way to customize this pie chart as a whole after it's created - instead you need to use indexing or <span style=\"font-family: monospace\">findobj<\/span> to get the right text or patch handles and set properties on those. For example, here's how you would have to work with the old <span style=\"font-family: monospace\">pie<\/span> command to customize the chart's appearance and to use the standard ColorOrder colors you see elsewhere in MATLAB. (Requests for a simple way to change pie's colors is something we hear frequently from customers <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/515880-how-can-i-change-the-colours-of-segmentation-on-a-chart-pie#answer_424428\">in the Community<\/a>.)<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">p = pie([10 11 9.5 16 18 17]);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #008013\">% Option 1: index to get every other handle which is a text object<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">txt = p(2:2:end);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">set(txt,<span style=\"color: #a709f5\">'Color'<\/span>,[0.5 0.5 0.5])<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #008013\">% Option 2: alternatively, use findobj to get the set of objects with the desired \"Type\"<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">pch = findobj(p,<span style=\"color: #a709f5\">'Type'<\/span>,<span style=\"color: #a709f5\">'patch'<\/span>);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">set(pch,<span style=\"color: #a709f5\">'EdgeColor'<\/span>,<span style=\"color: #a709f5\">'w'<\/span>,<span style=\"color: #a709f5\">'LineWidth'<\/span>,2)<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">colors = get(gca,<span style=\"color: #a709f5\">'ColorOrder'<\/span>);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">colorsCellArray = mat2cell(colors,ones(7,1),3);<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">set(pch,{<span style=\"color: #a709f5\">'FaceColor'<\/span>},colorsCellArray(1:numel(pch)))<\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_3\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 505px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_4.png\" height=\"379\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"margin: 10px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Many of you have also reported running into surprising behaviors, most of which are due to the fact that the pie wedges are drawn in the data coordinates of a Cartesian axes. For example, the <span style=\"font-family: monospace\">xlabel<\/span> and <span style=\"font-family: monospace\">ylabel<\/span> functions appear to do nothing, while surprisingly the <span style=\"font-family: monospace\">view(3)<\/span> command, which rotates the axes, actually works.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">pie([10 11 9.5 16 18 17])<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">xlabel(<span style=\"color: #a709f5\">'Some important data'<\/span>) <span style=\"color: #008013\">% doesn't show up, because pie sets the axes visibility off<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">view(3) <span style=\"color: #008013\">% wow, that works!<\/span><\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_4\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 491px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_5.png\" height=\"368\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 id=\"H_9A6E400E\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 20px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">New &amp; improved <span style=\"font-family: monospace\">piechart<\/span> and <span style=\"font-family: monospace\">donutchart<\/span> functions<\/h2>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Because we hear you, and because we don't judge you for needing an extra serving of pie, we are excited to introduce a new and improved <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/piechart.html\"><span style=\"font-family: monospace\">piechart<\/span><\/a> and her fashion-forward BFF <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/donutchart.html\"><span style=\"font-family: monospace\">donutchart<\/span><\/a> in R2023b.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">data = [10 11 9.5 16 18 17];<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">tiledlayout(<span style=\"color: #a709f5\">'horizontal'<\/span>)<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">nexttile<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">pc = piechart(data);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">nexttile<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">donutchart(data);<\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_5\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 497px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_6.png\" height=\"373\" \/><\/div>\n<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 6px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">pc <span style=\"color: #008013\">% let's check out some of the properties ...<\/span><\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableStringElement\" style=\"width: 1146px;font-style: normal;font-size: 12px\" data-testid=\"output_6\">\n<div class=\"textElement eoOutputContent\" style=\"max-height: 261px;font-style: normal;font-size: 12px\" data-previous-available-width=\"1109\" data-previous-scroll-height=\"167\" data-hashorizontaloverflow=\"false\">\n<div style=\"font-style: normal;font-size: 12px\"><span class=\"variableNameElement\" style=\"font-style: normal;font-size: 12px\">pc = <\/span><\/div>\n<div style=\"font-style: normal;font-size: 12px\">\n<p>PieChart with properties:<\/p>\n<p>ColorOrder: [7\u00d73 double]<br \/>\nFaceAlpha: 0.6000<br \/>\nEdgeColor: [0.1500 0.1500 0.1500]<br \/>\nLabels: [\"12.3%\" \"13.5%\" \"11.7%\" \"19.6%\" \"22.1%\" \"20.9%\"]<br \/>\nData: [10 11 9.5000 16 18 17]<br \/>\nNames: [\"data1\" \"data2\" \"data3\" \"data4\" \"data5\" \"data6\"]<\/p>\n<p>Show all properties<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"margin: 10px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Both charts are <span style=\"font-weight: bold\">real<\/span> graphics objects with properties, so you'll be able to work with them the way you do the other graphics objects you know and love. This also means we have a way to start addressing all your feature requests. Of course, we weren't able to deliver everything in this first version, but we are excited to have some fresh new ground to work on.<\/div>\n<h3 id=\"H_4AFDAA39\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Custom Styles<\/h3>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">We've added properties to the new <span style=\"font-family: monospace\">PieChart<\/span> and <span style=\"font-family: monospace\">DonutChart<\/span> objects to give you some of the controls you've been looking for. For instance, in this example I'm setting the <span style=\"font-family: monospace\">EdgeColor<\/span>, <span style=\"font-family: monospace\">LineWidth<\/span> and <span style=\"font-family: monospace\">InnerRadius<\/span> properties to achieve a more minimal look with white edges and a thinner donut. And the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/colororder.html\"><span style=\"font-family: monospace\">colororder<\/span><\/a> command can be used to change the color palette with one line of code! Note also that I'm shifting the <span style=\"font-family: monospace\">StartAngle<\/span> to -45 degrees to change the orientation of the chart, and I could have swapped the <span style=\"font-family: monospace\">Direction<\/span> of the wedges to clockwise if I had wanted to. The ability to change the orientation of a pie chart was another common <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/1882617-change-the-position-of-a-pie-chart#answer_1133507\">request<\/a> for the old pie chart that we were never able to accommodate.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc = donutchart([60 17 8 15], [<span style=\"color: #a709f5\">\"pass\"<\/span>,<span style=\"color: #a709f5\">\"in progress\"<\/span>,<span style=\"color: #a709f5\">\"filtered\"<\/span>,<span style=\"color: #a709f5\">\"fail\"<\/span>]);<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc.EdgeColor = <span style=\"color: #a709f5\">'w'<\/span>;<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc.LineWidth = 2;<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc.InnerRadius = 0.7;<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">colororder <span style=\"color: #a709f5\">meadow<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc.StartAngle = -45;<\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_7\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 504px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_7.png\" height=\"379\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 id=\"H_DA185EFB\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Support for Tables<\/h3>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The new <span style=\"font-family: monospace\">piechart<\/span> and <span style=\"font-family: monospace\">donutchart<\/span> functions support tables and table variable names as inputs. We've been adding support for plotting data directly from tables to many of our existing plotting functions, like <span style=\"font-family: monospace\">plot<\/span> and <span style=\"font-family: monospace\">scatter<\/span>, and the new <span style=\"font-family: monospace\">piechart<\/span> and <span style=\"font-family: monospace\">donutchart<\/span> functions extend the pattern. You can pass in a table as the first argument and then indicate which table variables to use for the data, and optionally the names.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #008013\">% Create an example table<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">Status = [<span style=\"color: #a709f5\">\"pass\"<\/span>,<span style=\"color: #a709f5\">\"in progress\"<\/span>,<span style=\"color: #a709f5\">\"filtered\"<\/span>,<span style=\"color: #a709f5\">\"fail\"<\/span>]';<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">January = [132 4 24 228]';<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">February = [240 68 32 60]';<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding: 0px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">March = [344 12 4 48]';<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">t = table(Status, January, February, March)<\/div>\n<\/div>\n<div>\u00a0 \u00a0 \u00a0<span style=\"font-family: Consolas, Inconsolata, Menlo, monospace;font-size: 12px\">t = 4\u00d74 table<\/span><\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableTableElement\" style=\"width: calc(100% - 5px)\" data-testid=\"output_8\">\n<div id=\"variableeditor_client_Document_0\" class=\"ClientDocument veSpecifier table DataFitToViewport\" aria-labelledby=\"variableeditor_views_SummaryBar_0\">\n<div id=\"variableeditor_TableViewModel_0\" class=\"table ClientViewDiv hasSummaryBar\" style=\"width: 100%;overflow: auto\" data-viewid=\"__1\">\n<table style=\"border-spacing: 0px;border-collapse: collapse;width: 500px\" cellspacing=\"0\">\n<thead>\n<tr>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 34px;text-align: left;font-weight: bold\" rowspan=\"1\"><\/th>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 91px;min-width: 91px;max-width: 91px;text-align: center;font-weight: bold\">Status<\/th>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 94px;min-width: 94px;max-width: 94px;text-align: center;font-weight: bold\">January<\/th>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 102px;min-width: 102px;max-width: 102px;text-align: center;font-weight: bold\">February<\/th>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 82px;min-width: 82px;max-width: 82px;text-align: center;font-weight: bold\">March<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 34px;border-width: 0px 1px 1px;border-style: solid;text-align: left;font-weight: bold\">1<\/th>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 91px;min-width: 91px;max-width: 91px;border-width: 0px 1px 1px;border-style: solid;text-align: left\">\"pass\"<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 94px;min-width: 94px;max-width: 94px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">132<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 102px;min-width: 102px;max-width: 102px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">240<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 82px;min-width: 82px;max-width: 82px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">344<\/td>\n<\/tr>\n<tr>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 34px;border-width: 0px 1px 1px;border-style: solid;text-align: left;font-weight: bold\">2<\/th>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 91px;min-width: 91px;max-width: 91px;border-width: 0px 1px 1px;border-style: solid;text-align: left\">\"in\u00a0progress\"<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 94px;min-width: 94px;max-width: 94px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">4<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 102px;min-width: 102px;max-width: 102px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">68<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 82px;min-width: 82px;max-width: 82px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">12<\/td>\n<\/tr>\n<tr>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 34px;border-width: 0px 1px 1px;border-style: solid;text-align: left;font-weight: bold\">3<\/th>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 91px;min-width: 91px;max-width: 91px;border-width: 0px 1px 1px;border-style: solid;text-align: left\">\"filtered\"<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 94px;min-width: 94px;max-width: 94px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">24<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 102px;min-width: 102px;max-width: 102px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">32<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 82px;min-width: 82px;max-width: 82px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">4<\/td>\n<\/tr>\n<tr>\n<th style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 6px 3px 3px;width: 34px;border-width: 0px 1px 1px;border-style: solid;text-align: left;font-weight: bold\">4<\/th>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 91px;min-width: 91px;max-width: 91px;border-width: 0px 1px 1px;border-style: solid;text-align: left\">\"fail\"<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 94px;min-width: 94px;max-width: 94px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">228<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 102px;min-width: 102px;max-width: 102px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">60<\/td>\n<td style=\"font-family: Arial, sans-serif;font-size: 12px;overflow: hidden;padding: 3px;width: 82px;min-width: 82px;max-width: 82px;border-width: 0px 1px 1px;border-style: solid;text-align: right\">48<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding-top: 6px;padding-right: 45px;padding-bottom: 0px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;text-align: left\">figure<\/div>\n<\/div>\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 0px;padding-top: 0px;padding-right: 45px;padding-bottom: 0px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc = donutchart(t,<span style=\"color: #a709f5\">'January'<\/span>,<span style=\"color: #a709f5\">'Status'<\/span>);<br \/>\ncolororder <span style=\"color: #a709f5\">meadow<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_9\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 507px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_8.png\" height=\"380\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">You can even update your chart to display the data from a different variable! For instance, here we start by visualizing the data from the \"January\" variable, and then switch the DataVariable to \"February\" to see how things have changed from month to month. The ability to update the data on an existing object will also make the new objects great for app building and animation workflows.<\/div>\n<div style=\"background-color: #f5f5f5;margin: 10px 0 10px 0\">\n<div class=\"inlineWrapper\">\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #008013\">% Swap the data variable to look at another month<\/span><\/div>\n<\/div>\n<div class=\"inlineWrapper outputs\">\n<div style=\"border-radius: 0px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">dc.DataVariable = <span style=\"color: #a709f5\">'February'<\/span>;<\/div>\n<\/div>\n<div style=\"padding: 10px 0px 6px 17px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px;line-height: 17.234px\">\n<div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsFigure\" data-testid=\"output_10\">\n<div class=\"figureElement eoOutputContent\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"max-width: 560px;width: 506px;padding-bottom: 0px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_9.png\" height=\"379\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 id=\"H_505E2842\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Interactive Graphics Workflows<\/h3>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Finally, the new <span style=\"font-family: monospace\">PieChart<\/span> and <span style=\"font-family: monospace\">DonutChart<\/span> objects support interactive workflows. You can explore your data with data tips by hovering over the chart. In this example, <span style=\"font-family: monospace\">piechart<\/span> has binned a bunch of categorical values, allowing us to visualize the relative proportions of species in the array. The data tip shows us the count of how many \"virginica\" items were binned into the yellow wedge. And you can interactively modify the properties I described earlier, and discover what other properties are available, in the Property Inspector.<\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">load fisheriris.mat<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">piechart(categorical(species([1:75 135:end])));<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 497px;height: 396px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_10.png\" alt=\"\" width=\"533\" height=\"425\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 638px;height: 459px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_11.png\" alt=\"\" width=\"872\" height=\"488\" \/><\/div>\n<h2 id=\"H_EFED7FE6\" style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 20px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">What's next?<\/h2>\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">We can't wait to hear what you think of these new charts! Are you #teamdonut with me, or maybe you like things the old fashioned way? And what features are you excited for us to add next? Based on past requests, I expect I'll hear from many of you about what you want to do with those labels - do tell!<\/div>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx\"><button class=\"btn btn-sm btn_color_blue pull-right add_margin_10\">Download Live Script<\/button><\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2023\/11\/PiechartDonutchart.mlx-11-12-23_6.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"Piechart and donut chart\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>Guest Writer: Abby Skofield<br \/>\nIn today's article, Abby Skofield slices through the debate about pie charts and introduces two new delectable desserts recently added to the MATLAB menu. Abby is a... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2023\/11\/13\/pie-charts-and-donut-charts\/\">read more >><\/a><\/p>\n","protected":false},"author":198,"featured_media":457,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,11,2,20,1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/472"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/users\/198"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/472\/revisions"}],"predecessor-version":[{"id":670,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/472\/revisions\/670"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media\/457"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media?parent=472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/categories?post=472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/tags?post=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}