library(rgdal)
## Loading required package: sp
## rgdal: version: 1.3-6, (SVN revision 773)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
## Path to GDAL shared files: /usr/share/gdal/2.1
## GDAL binary built with GEOS: TRUE
## Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
## Path to PROJ.4 shared files: (autodetected)
## Linking to sp version: 1.3-1
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.3, PROJ 4.9.2
library(sp)
library(cartography)
library(RColorBrewer)
# load GGplot2
library(ggplot2)
# Create test data.
dat = data.frame(count=c(95, 5), category=c("Primary school completion rate for both sex", "droped out of primary school"))
# Add addition columns, needed for drawing with geom_rect.
dat$fraction = dat$count / sum(dat$count)
dat = dat[order(dat$fraction), ]
dat$ymax = cumsum(dat$fraction)
dat$ymin = c(0, head(dat$ymax, n=-1))
# Make the plot
p1 = ggplot(dat, aes(fill=category, ymax=ymax, ymin=ymin, xmax=4, xmin=3)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0, 4)) +
theme(panel.grid=element_blank()) +
theme(axis.text=element_blank()) +
theme(axis.ticks=element_blank()) +
annotate("text", x = 0, y = 0, label = "the indicaor of the rate
of studentS who completd
the primary school
in morocco") +
labs(title="")
p1
# Define the cars vector with 5 values
studentrate <- c(25, 50, 75, 100)
years <- c(1960,1980,2005,2015)
# Graph the cars vector with all defaults
plot(years,studentrate)
`
# Define the cars vector with 5 values
#cars <- c(1, 3, 6, 4, 9)
studentrate <- c(25, 50, 75, 100)
years <- c(1960,1980,2005,2015)
# Graph cars using blue points overlayed by a line
plot(years, studentrate,type="o", col="blue")
# Create a title with a red, bold/italic font
title(main="student inrollement in primary schools in morocco between 1960 and2015", col.main="red", font.main=4)
# Define cars vector with 5 values
studentpergender <- c(57,43 )
# Create test data.
# Create a pie chart for cars
pie(studentpergender)
# custom colors and labels
pie(studentpergender, main="student enrollement in primary school per gender in morocco ", col=rainbow(length(studentpergender)),
labels=c("boys","girls"))
``
barplot( c(45, 42,68), main="Education expenditure in morocco", xlab="the last three years",ylab="billions Moroccan Dirham")
#barplot(counts, main="Car Distribution",
# xlab="Number of Gears")
# 3D Exploded Pie Chart
library(plotrix)
slices <- c(40.99, 43.75, 14.29, 1.08)
lbls <- c("morocco", "algeria", "tunisia", "muritania")
pie3D(slices,labels=lbls,explode=0.1,
main="Pie Chart of Countries ")