- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create pie chart in base R?
A pie chart is a circular representation of data which is created for either nominal data or ordinal data. The slices in the pie chart depend on the magnitude of the data values. If we want to create a pie chart in base R then pie function can be used.
For Example, if we have a vector called X then the pie chart for values in X can be created by using the below command −
pie(X)
Example
Following snippet creates a sample data frame −
x<-sample(1:100,3) pie(x)
Output
If you execute the above given snippet, it generates the following Output −
Example
Following snippet creates a sample data frame −
x<-sample(1:100,3) pie(x) y<-c(24,28,80,45,38) pie(y)
Output
If you execute all the above given snippets as a single program, it generates the following Output −
- Related Articles
- How to create pie chart in base R with labels?
- How to create pie chart using plotly in R?
- How to create a Pie chart using JavaFX?
- ReactJS: How to Create a Pie Chart using Recharts?
- Explain: How to draw Pie chart?
- How to use pie chart graph in android?
- How to plot a nested pie chart in Matplotlib?
- How to create heatmap in base R?
- How to plot pie-chart with a single pie highlighted with Python Matplotlib?
- How to create bar chart using ggplot2 with chart sub-title in R?
- How to have actual values in Matplotlib Pie Chart displayed?
- How to create an arrow in base R?
- How to add a legend to a Matplotlib pie chart?
- How to create a bar chart using plotly in R?
- How to create grouped line chart using ggplotly in R?

Advertisements