Next Post:

Creating Dome Structures In Solidworks

Creating Pie Charts In MatLab(Illustrated Expression)


Pie charts are very important graph type in statistics and data analyses. They can be a very good illustratin of datas on a round graph. You can create pie chrats in Matlab with ‘pie()’ command. In here, we will explain how to create pie charts in Matlab, with a very basic example below.

How To Use ‘pie()’ Command In MatLab?

Drawing pie charts in Matlab.

To create pie charts in Matlab, you need to properly define all the elements of pie() command in Matlab. First of all, we need to define the percentages of variables in pie chart. For example, we created a vector that includes populations of different countries in millons as shown by red arrow above. We calculated the sum of all populations with ‘sum()’ command, then we divided the population vector with this value to obtain percentages of populations to show at pie chart. We said ‘percentage’ to this vector.

Also you can directly create a vector that includes percentages for pie chart.

To show names of segments in pie chart, create a string vector that must include the names of each segments coherent with populations. We created it as shown by red arrow above, includes country names.

YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!

You can highlight the required variables in pie chart with highlight() command. Do this by creating a vector that include zeros and ones. The dimension of this vector must be same with other vectors that are used in pie chart generation. Ones will highlight the respective element in pie chart. For example Ecuador and Chile are highlighted becuase of the elements in ‘highlight’ vector that represents them respectively are ones.

Download And Install Matlab 2020!

Type percentage, highlight and string vector into pie() command as shown in green box above. Then press ‘Enter’ from your keyboard to create pie chart like above.

Creating pie charts with pie() command is very easy like above in Matlab. Do not forget to leave your comments and questions about pie charts in Matlab below. You precious feedbacks are very important for us.

  • Site Comments

At least 10 characters required.