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

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com