RStudio: Beginners guide to create Piechart in R using GGPLOT [code included]
HTML-код
- Опубликовано: 21 авг 2024
- Learn to create a piechart using GGPLOT in R.
View the code rpubs.com/tech...
Simple, practical and to the point explaination.
Step by step approach.
First we get the latest COVID19 data online.
Then we create a basic Piechart.
Then we customise the text which gets displayed in the Piechartsections.
Then we create a palette of colours so that each section of the Piechartcan be filled in a different colour.
Lastly we add the title, subtitle to our Piechart to make it ready for use in your documents.
Other data visualisation videos
• GGPLOT charts and char...
¡Muchas gracias por el Script! Analítica de datos.
Thank you so much. Now I know how to paste labels of percentage in my pie charts :)
Glad it was helpful!
Thank you because of your video I rectified a minor error
Glad it helped
hi, i keep getting this error.
Error in paste0(round(value/sum(value) * 100), "%") :
object 'value' not found
can i please know why
i followed every line of code
Check your data, looks like the 'value' column is not there. I have uploaded the code and also created an example for you, which creates the data locally (I assumed that somehow you could not download the data from web ). See the very last example in the codesheet.
rpubs.com/techanswers88/piechart-using-ggplot
Hope it helps.
Hey mate, thank you very much for this video. I am very beginner at R and I managed to get the same results with the same dataset. However when I try to run it with my own dataset I get Error in FUN(X[[i]], ...) : object 'variable' not found
in the codeline pl
Hi there. Please check and view your dataset. The error means that in your own dataset you do not have a data field called 'variable'.
Check the names of the fields in your dataset and use a field which you want to keep on your x axis and the value which you want to use in the y axis from your own dataset. All the best.
@@DataAnalytic Thank you for the reply, I have gotten a little further in my R skills, but now after running step 1 and trying to make the very first bar figure I run into Error: geom_bar requires the following missing aesthetics: x and y
Thank you for your reply!
Hi
The x and the y aesthetics need to be defined for the barchart.
eg. ggplot(data = Top20, aes(x = variable, y = value) + geom_bar(stat="identity")
Have a look at the video ruclips.net/video/MT_XkTeGJ_Y/видео.html which also has the code.
All the best.