# Kod 1.3. Konstrukcja wykresu kołowego – zmienna cyl
tab.cyl=table(mtcars$cyl)
pie(tab.cyl)############################################################################
### Dodatki ###
############################################################################
#
tab.gear=table(mtcars$gear)
pie(tab.gear)
# źródło: https://www.statmethods.net/graphs/pie.html
slices <- c(10, 12,4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pie(slices, labels = lbls, main="Pie Chart of Countries")
# źródło: https://www.statmethods.net/graphs/pie.html
# Pie Chart with Percentages
slices <- c(10, 12, 4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slices,labels = lbls, col=rainbow(length(lbls)), main="Pie Chart of Countries")
# źródło: https://www.statmethods.net/graphs/pie.html
# 3D Exploded Pie Chart
library(plotrix)
slices <- c(10, 12, 4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pie3D(slices,labels=lbls,explode=0.1,main="Pie Chart of Countries ")