In this post, we show How to Create Donut Chart in R. For this particular example we are going to be making use of the LessR. This package would take your data and then plot your donut chart. And for this we can choose what type of the data to show and not show and then move for the further customization.
So previously I covered the Ridgeline Chart in R. That was a good chart for the population and variety of other options that anyone would want to see in terms of the content. So make sure to check that tutorial too. It's a good option for the larger population specific dataset which I also covered in earlier parts.
This tutorial series that I made and executed on the RStudio. So if you happen to have the IDE that does the same. You can make use of the same and execute the code explained in this post. I am sure you would be able to get the results as shown here too. So that kind of explains how the code would work up on chart.
I have created a video to give you an overview on How to Create Donut Chart in R. You should give this one a try.
Let's take a look at the library that we can make use of for the chart.
install.packages(lessR)
library(lessR)
Now the next things would be make use of the data that we can use as a sample data. And then that would be used for the pushing into function that would plot the chart. We use the employee data which is sample data of the package.
data <- rd("Employee")
Now let's draw the piechart which is going to be the donut chart in R. And that would help you draw and make things show as per your dataset. So here's the function.
PieChart(Dept, data = data,
main = NULL)
Let's take a look at how the plot is being shown here.
That's it. We managed to draw the plot as per our expectations. As you can see the database here is the employee and also the content in the same also goes to show in the donut chart. Now you are limited to this data but you can always change to any other data set.
You should use this for performance based data. Say like performance of the students in schools, or your income, revenue, expenses and taxes sort of data. So this way you would be able to understand where to use this type of the chart. And that would give more confidence on what to do with this type of the charts and where to draw them.
My purpose was to explain some of the simple charts. And I am sure that this would be giving you an idea on how to use these charts. So in near future I can change the type of library being used and that would change the chart and the graph as well. So in that note It would be reasonable to make use of the same in the data if required.
My tutorial series on the data science has been going on good so far. But I can barely break the 100 views each videos. And it takes like years to even reach 1000 views. So i need your help. If you are from US, UK, Canada then please do share the content and let me know if you need any other specific videos from me.
If you happen to like this content, do give me feedback over there and that would help me improve my efforts in near future.
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.