TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Matlab

Pie Chart Example using MATLAB

Introduction

In this tutorial, we will learn how to plot a Pie chart using MATLAB. A sample script using the pie() command.

pie(V)  2D plots the pie chart using the data in V. The 3D version of the command is pie3.

legend adds the legend for the plotted pie chart. We can specify the labels for the chart.

Sample Script

A sample script to plot Pie chart. The data used is student subject marks in each of the subjects. The legend labels for the plot are the subjects.

 

% Sample Matlab Script for Pie Chart
% www.TestingDocs.com - MATLAB Tutorials
% Clean the Matlab Environment
clc
clear
close all

% Sample Student marks data vector for the Pie chart
pieData = [35 75 97 39 45 66];

% Generate the Pie Chart
pie(pieData);
% Title to the Pie Chart
title('Pie Chart Demo - www.TestingDocs.com'); 
% Legend to the Pie Chart
subjects = {'English','Maths','Physics','Chemistry','Biology','History'};
legend(subjects,'Location','southoutside','Orientation','horizontal')

Screenshot

Run the script to view the pie chart.

Click on the Editor >> Run green run button from the toolstrip.

 

Pie Chart Demo Matlab

 

MATLAB Tutorials on this website can be found here:

https://www.testingdocs.com/matlab-tutorial/

To try MATLAB Software or to learn more about MATLAB,

MATLAB official website:

https://www.mathworks.com

Related Posts

Matlab /

Taylor series expansion MATLAB Example

MATLAB For Loop Script

Matlab /

For Loop Example in MATLAB

plot command MATALB

Matlab /

MATLAB 2D Plot command

New Function

Matlab /

Functions in MATLAB

MATLAB Command Window

Matlab /

MATLAB Command Window

‹ Functions in MATLAB› MATLAB 2D Plot command

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version