Introduction aux graphiques avec R - CEL
30 oct. 2016 Pour avoir un aperçu des possibilités graphiques du logiciel R ... Comme pour plot
Fonctions graphiques de R
Un rapide aperçu des très riches fonctions graphiques de R pour Organisation des tutoriels R. ... Fonctions pie barplot
Histogrammes
REPRESENTATIONS GRAPHIQUES SOUS R. HISTOGRAMMES package 'ade4' was built under R version 2.3.1 ... barplot. Représentation graphique sentation graphique.
Manipulation de données avec le langage R
graphique (boxplot barplot
LART GRAPHIQUE SOUS R
Utiliser le logiciel R pour produire des graphiques de haute qualité présente un certain La fonction barplot() possède aussi de nombreux arguments.
qplot R Graphics Cheat Sheet
7 déc. 2018 Before using qplot in a new R session always first load the ggplot2 ... Barplot qplot(mpg$drv
GERAD - Les graphiques dans R par Odile Wolber
barplot(x). Histogramme des valeurs de x mosaicplot(x). Si x est une matrice ou un data.frame graphe en mosaï?que des résidus d'une.
Diapositive 1
Pr. Bruno Falissard. Introduction à la statistique avec R > Représentations Graphiques. Diagramme en bâton. > barplot(table(smp.c$prof)) agriculteur artisan.
TP 3 : Graphiques avec R Table des matières
barplot(X). Diagramme en bâtons de X qqplot(XY). Graphe quantile-quantile des échantillons X et Y. Table 1 – Fonctions graphiques de haut-niveau.
enrichplot: Visualization of Functional Enrichment Result
R topics documented: automatically split barplot or dotplot into several facets ... barplot.enrichResult. 3. Arguments by one of 'row' or 'column'.
[PDF] R Bar Plot - barplot() - 11 Examples - Tutorial Kart
In this tutorial we will learn the syntax of barplot() function and how to use barplot() function to draw bar plots and how to style the bars of bar plot
[PDF] GERAD - Les graphiques dans R par Odile Wolber
barplot(x) trace l'histogramme des valeurs de x où x est une variable qualitative (un facteur d'une data frame) Arguments : barplot( height width = 1 space
ggplot2 barplots : Guide de démarrage rapide - Logiciel R - STHDA
Ce tutoriel R décrit comment créer un graphique en barre (barplots) en utilisant le logiciel R et le package ggplot2 La fonction geom_bar() peut être
[PDF] TP 3 : Graphiques avec R Table des matières - Aude Illig
La commande R pour obtenir un diagramme en bâtons est barplot(height) où height est le 5 Page 6 vecteur ou la matrice de données Sont disponibles en plus
[PDF] Fonctions graphiques de R
Un rapide aperçu des très riches fonctions graphiques de R pour jpeg("fichier jpeg") # ou bmp() png() pdf () fonctions pie() et barplot()
[PDF] Notes de Cours sur le logiciel R
22 jan 2018 · Le logiciel R est un freeware disponible sur le site http://cran r-project org/ La fonction barplot pour des variables quantitatives
[PDF] Graphiques de base
http://pbil univ-lyon1 fr/R/Rfig pdf Logiciel R version 4 2 0 A bar chart or dot chart is a preferable way of displaying this type of data
[PDF] Manipulation de données avec le langage R
http://research stowers-institute org/efg/R/Color/Chart/ColorChart pdf Gallerie de graphiques (avec Barplot (à ne pas confondre avec l'histogramme !!)
[PDF] LART GRAPHIQUE SOUS R - Nicolas Casajus
la production de graphiques sous R Parmi eux citons le package lattice implémenté La fonction barplot() possède aussi de nombreux arguments
SEMIN-
HistogrammesSéverine ZIRAH
Molécules de communication et adaptation des micro-organismesFRE 3206 CNRS / USM 502 MNHN
SEMIN-R du MNHN | 21 Janvier 2009
REPRESENTATIONS GRAPHIQUES SOUS R
HISTOGRAMMES
Séverine ZIRAHMolécules de communication et adaptation des micro-organismesFRE 3206 CNRS / USM 502 MNHN
Sémin"R - 22.01.2009
ReprReprReprRepréééésentation graphique dsentation graphique dsentation graphique dsentation graphique d""""une distributionune distributionune distributionune distribution
Variable
quantitative discrète qualitative quantitative continueReprReprReprRepréééésentation graphique dsentation graphique dsentation graphique dsentation graphique d""""une variable qualitativeune variable qualitativeune variable qualitativeune variable qualitative
> library(ade4)Warning message:package "ade4" was built under R version 2.3.1 > data(aviurba)> aviurba$traits$feed.hab[1] omni omni omni grani grani grani insect insect insect
[10] insect insect insect omni insect insect insect insect insect [19] omni insect insect insect insect insect insect insect grani [28] grani grani grani grani grani grani grani grani insect [37] omni omni omni omni Levels: insect grani omni> plot(aviurba$traits[,1],main="feeding habit",col="blue") > plot(aviurba$traits[,2],main="feeding stratum",col="magenta")Diagramme en bâton
plot 1Fréquence
np p 100n TOTAL ni i n1 1
Effectif
Classe
1Fréquence
np p 100n TOTAL ni i n1 1
Effectif
Classe
nnfp p=nn f1 1= nn fi i= 1 100f´ if´ 100
pf´ 100
ReprReprReprRepréééésentation graphique sentation graphique sentation graphique sentation graphique àààà partir dpartir dpartir dpartir d""""un tableau dun tableau dun tableau dun tableau d""""effectifs/de freffectifs/de freffectifs/de freffectifs/de frééééquencesquencesquencesquences
> table(aviurba$traits$feed.hab)insect grani omni19 12 9 > table(aviurba$traits$feed.strat)ground aerial foliage
27 3 10 > table(aviurba$traits$breeding)
ground building scrub foliage6 14 12 8
> table(aviurba$traits$migratory)resident migrant23 17
Diagramme en bâton
plotbarplottableTableau d"effectifs> plot(table(aviurba$traits[,1]),col="blue", main="feeding habit",lwd=50,type="h",lend="butt",ylab="")
ReprReprReprRepréééésentation graphique sentation graphique sentation graphique sentation graphique àààà partir dpartir dpartir dpartir d""""un tableau dun tableau dun tableau dun tableau d""""effectifs/de freffectifs/de freffectifs/de freffectifs/de frééééquencesquencesquencesquences
plot > plot(table(aviurba$traits[,1]), col="blue", main="feeding habit") > barplot(table(aviurba$traits[,1]),main="feeding habit",col="blue") > barplot(table(aviurba$traits[,2]),main="feeding stratum",col="magenta") > barplot(table(aviurba$traits[,3]),main="breeding stratum",col="green") > barplot(table(aviurba$traits[,4]),main="migration stragegy",col="red") barplotReprReprReprRepréééésentation graphique sentation graphique sentation graphique sentation graphique àààà partir dpartir dpartir dpartir d""""un tableau dun tableau dun tableau dun tableau d""""effectifs/de freffectifs/de freffectifs/de freffectifs/de frééééquencesquencesquencesquences
ReprReprReprRepréééésentation graphique dsentation graphique dsentation graphique dsentation graphique d""""une variable qualitativeune variable qualitativeune variable qualitativeune variable qualitative
Diagrammes en bâton multiples> t<-cbind(table(aviurba$traits[,1]),c(15,15,10)) barplot > barplot(t,legend.text=rownames(t), col=c(2:4),main="feeding habit", names=c("sample 1","sample 2"), xlim=c(0,8),width=2) > barplot(t,legend.text=rownames(t), col=c(2:4),main="feeding habit", names=c("sample 1","sample 2"), xlim=c(0,20),width=2,beside=TRUE)ReprReprReprRepréééésentation graphique dsentation graphique dsentation graphique dsentation graphique d""""une distribution discrune distribution discrune distribution discrune distribution discrèèèètetetete
plot > t<-table(rpois(100,5))> t1 2 3 4 5 6 7 8 9 10 11 4 9 18 12 17 12 11 8 6 2 1 > plot(t,col="blue",main="rpois(100,lambda=5)",lwd=20,type="h",lend="butt",ylab="")
> barplot(t,col="blue",main="rpois(100,lambda=5)") barplotReprReprReprRepréééésentation graphique dsentation graphique dsentation graphique dsentation graphique d""""une variable quantitative continueune variable quantitative continueune variable quantitative continueune variable quantitative continue
np vp p 1 n TOTAL ni V i i n1 V 1 1Fréquence
Effectif
Valeur
(ou valeur centrale)Classe
nnfp p =nn f 1 1 nn f i iValeur centrale =
2 supérieure borneinférieure borne+ Les données sont regroupées en classes correspondant à des intervalles de valeurs. Largeur de classeParamètres à bien choisir :Nombre de classes
Point de départ
Juxtaposition de rectangles dont les bases correspondent aux intervalles de valeurs des classes successives et dont les aires correspondent aux fréquences des classes.Variante : Hauteurs des rectangles = effectifs par classe HistogrammeTableau d"effectifs / de fréquences
histHistogramsDescription:
The generic function "hist" computes a histogram of the given data values. If "plot=TRUE", the resulting object of "class "histogram"" is plotted by "plot.histogram", before itis returned.Usage:
hist(x, ...) ## Default S3 method: hist(x, breaks = "Sturges", freq = NULL, probability= !freq, include.lowest = TRUE, right = TRUE, density = NULL, angle = 45, col = NULL, border = NULL, main = paste("Histogram of" , xname), xlim = range(breaks), ylim = NULL, xlab = xname, ylab, axes = TRUE, plot = TRUE, labels = FALSE, nclass = NULL, ...) > help(hist) Histogrammes Histogrammes Histogrammes Histogrammes ---- exempleexempleexempleexemple > library(MASS) > data(crabs) > str(crabs)`data.frame": 200 obs. of 8 variables: $ sp : Factor w/ 2 levels "B","O": 1 1 1 1 1 1 1 1 1 1 ... $ sex : Factor w/ 2 levels "F","M": 2 2 2 2 2 2 2 2 2 2 ... $ index: int 1 2 3 4 5 6 7 8 9 10 ... $ FL : num 8.1 8.8 9.2 9.6 9.8 10.8 11.1 11.6 11.8 11.8 ... $ RW : num 6.7 7.7 7.8 7.9 8 9 9.9 9.1 9.6 10.5 ... $ CL : num 16.1 18.1 19 20.1 20.3 23 23.8 24.5 24.2 25.2 ... $ CW : num 19 20.8 22.4 23.1 23 26.5 27.1 28.4 27.8 29.3 ...$ BD : num 7 7.4 7.7 8.2 8.2 9.8 9.8 10.4 9.7 10.3 ...> dataB<-crabs[which(crabs$sp=="B"),4]> dataO<-crabs[which(crabs$sp=="O"),4]> hist(dataB)
Frontal lobe size
Histogramme sans Histogramme sans Histogramme sans Histogramme sans """" plot plot plot plot »»»»
> hist(dataB,plot=FALSE)$breaks[1] 6 8 10 12 14 16 18 20 22$counts[1] 1 10 18 20 24 19 7 1$intensities[1] 0.004999999 0.050000000 0.090000000 0.100000000 0.120000000 0.095000000
[7] 0.035000000 0.005000000 $density [1] 0.004999999 0.050000000 0.090000000 0.100000000 0.120000000 0.095000000 [7] 0.035000000 0.005000000 $mids [1] 7 9 11 13 15 17 19 21 $xname [1] "dataB" $equidist [1] TRUE attr(,"class") [1] "histogram"10.010.070.190.240.200.180.100.01
Fréquence
0.095 19 ]16-18] 0.035 7 ]18-20] 0.005 1 ]20-22] 0.120 24]14-16] 0.5 100
TOTAL 0.100 20 ]12-14] 0.090 18 ]10-12] 0.050 10 ]8-10] 0.005 1 [6-8]
Fréquence
par mmEffectif
Frontal lobe
size (mm) Pour calculer la hauteur des rectangles, il suffit de diviser la fréquence par la longueur des classes. h$counts h$densityHistogrammes et tableaux dHistogrammes et tableaux dHistogrammes et tableaux dHistogrammes et tableaux d""""effectifs/de freffectifs/de freffectifs/de freffectifs/de frééééquencesquencesquencesquences
right= "TRUE" : intervalles]a,b include.lowest= "TRUE" : premier intervalle [a,b]Histogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classes
breaks: one of: * a vector giving the breakpoints between histogram cells, * a single number giving the number of cells for the histogram, * a character string naming an algorithm to compute the number of cells (see Details), * a function to compute the number of cells. In the last three cases the number is a suggestion only. > sort(dataB)[1] 7.2 8.1 8.8 9.0 9.1 9.1 9.2 9.5 9.6 9.8 9.8 10.1 10.3 10.4 [15] 10.8 10.8 11.0 11.1 11.2 11.5 11.6 11.6 11.6 11.7 11.8 11.8 11.9 12.0 [29] 12.0 12.2 12.3 12.6 12.6 12.8 12.8 12.8 12.8 12.8 12.9 13.0 13.1 13.1 [43] 13.1 13.2 13.3 13.4 13.7 13.9 13.9 14.3 14.6 14.7 14.9 15.0 15.0 15.0 [57] 15.0 15.0 15.1 15.1 15.1 15.2 15.2 15.3 15.4 15.4 15.5 15.6 15.6 15.7 [71] 15.7 15.8 15.9 16.1 16.1 16.2 16.2 16.3 16.4 16.4 16.6 16.7 16.8 16.9 [85] 17.1 17.1 17.2 17.4 17.5 17.7 17.9 18.0 18.8 19.2 19.3 19.3 19.7 19.8 [99] 19.8 21.3Histogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classes
> hist(dataB,col="blue",breaks=seq(6,22,2)) > hist(dataB,col="grey") > hist(dataB,col="magenta",breaks=20) > hist(dataB,col="green",breaks=seq(6,22,1))Histogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classes
> nclass.Sturgesfunction (x) ceiling(log2(length(x)) + 1)Formule de Sturges:
la taille des classes est basée sur l"effectif de l"échantillon (nombre d"observations).Formule de Scott:
pour une distribution normale.Basée sur une estimation de la variance.
Formule de Freedman-Diaconis (FD):
basé sur l"espace inter-quartile. > help(nclass.Sturges)Algorithmes de calcul du nombre de classes
Nombre de classes = 1 + 3,3 log
10(n) > nclass.scottfunction (x) h <- 3.5 * sqrt(var(x)) * length(x)^(-1/3) ceiling(diff(range(x))/h) > nclass.FDfunction (x) r <- as.vector(quantile(x, c(0.25, 0.75))) h <- 2 * (r[2] - r[1]) * length(x)^(-1/3) ceiling(diff(range(x))/h)Histogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classes
> x<-rnorm(100) > NC <- function(x)c(Sturges=nclass.Sturges(x),Scott=nclass.scott(x),FD=nclass.FD(x)) > NC(x)Sturges Scott FD15 49 64 > par(mfrow=c(3,1))> hist(x,col="grey",main="Sturges")> hist(x,col="yellow",breaks="Scott",main="Scott")> hist(x,col="magenta",breaks="FD",main="Freedman-Diaconis")
n = 10 000 n = 100 n = 1 000Histogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classesHistogrammes et nombre de classes
Histogrammes et mesures de positionHistogrammes et mesures de positionHistogrammes et mesures de positionHistogrammes et mesures de position
min max C 25C 50
C 75
> hist(dataB) > abline(v=quantile(dataB),col="red",lwd=3)
Histogrammes et courbe de densitHistogrammes et courbe de densitHistogrammes et courbe de densitHistogrammes et courbe de densitéééé
density > hist(dataB,probability=TRUE,ylim=range(0,0.18),main="Frontal lobe size", xlab="FL(mm)",ylab="frequency per mm") > lines(density(dataB), col="blue",lwd=3) > lines(density(dataB, bw=0.5), col="red",lwd=3) Histogrammes multiplesHistogrammes multiplesHistogrammes multiplesHistogrammes multiples > library(Hmisc) > options(digits=1) > histbackback(dataB,dataO,xlab=c("Blue crabs","Orange crabs"), main="Frontal lobe size") histbackbackHistogrammes et nuages de pointsHistogrammes et nuages de pointsHistogrammes et nuages de pointsHistogrammes et nuages de points
scatter.with.hist > library(UsingR) > FL<-crabs[which(crabs$sp=="B"),4] > RW<-crabs[which(crabs$sp=="B"),5] > scatter.with.hist(FL,RW)Histogrammes / courbes de densitHistogrammes / courbes de densitHistogrammes / courbes de densitHistogrammes / courbes de densitéééé et nuages de pointset nuages de pointset nuages de pointset nuages de points
histSpike > library(Hmisc) > plot(FL,RW,lwd=3,col="blue") > histSpike(FL,3,add=TRUE,lwd=3) > histSpike(RW,4,add=TRUE,lwd=3) > histSpike(FL,3,type="density",col="red",lwd=3,add=TRUE) > histSpike(RW,4,type="density",col="red",lwd=3,add=TRUE)> library(gplots)> x <- rnorm(2000, sd=4)> y <- rnorm(2000, sd=1)> h2d <- hist2d(x,y,show=FALSE, same.scale=TRUE, nbins=c(20,30))
> persp( h2d$x, h2d$y, h2d$counts,ticktype="detailed", theta=30, phi=30, expand=0.5, shade=0.5, col="cyan",ltheta=-30) hist2d Histogrammes 2DHistogrammes 2DHistogrammes 2DHistogrammes 2D > library(iplots)> ihist(dataB) ihist Histogramme interactifHistogramme interactifHistogramme interactifHistogramme interactif Histogrammes multiplesHistogrammes multiplesHistogrammes multiplesHistogrammes multiples multhist > library(plotrix) > l <- list(runif(10)*10,1:10,c(1,1,1,1,4,8)) > l[[1]] [1] 4.2947159 8.1528581 7.3732668 9.7694257 6.5140932 7.5774233 0.3487045 [8] 4.3929983 2.2556319 1.8013953 [[2]] [1] 1 2 3 4 5 6 7 8 9 10 [[3]] [1] 1 1 1 1 4 8> multhist(l)Estimation de la densité
Soient n observations d"une variable aléatoire continue. On peut estimer la densité de cette distribution par la fonction :x 1 , x2 , ..., x
n )(1)(ˆ1∑-==n
i i hxxKnhxfCette approche consiste à utiliser une fenêtre mobile que l"on déplace sur l"axe des
valeurs de x et à compter le nombre d"occurrences appartenant à cette fenêtre. Cette méthode donne une estimation peu régulière. Si l"on veut une fonction lisse, il est possible de moyenner une fonction de densité connue (le noyau) le long des données observées.h : largeur de fenêtreK : densité de probabilité densité x h noyaufenêtrequotesdbs_dbs44.pdfusesText_44[PDF] barplot sous r
[PDF] autonomie du patient loi
[PDF] histogram r studio
[PDF] la littérature est elle une bonne arme contre les inégalités
[PDF] longtemps j'ai pris ma plume pour une épée citation
[PDF] la littérature est une arme citation
[PDF] la littérature est elle une bonne arme pour dénoncer des inégalités
[PDF] effectif corrigé calcul
[PDF] album respect du corps
[PDF] la litterature a t elle pour mission de denoncer
[PDF] touche pas ? mon corps
[PDF] respecter le corps des autres
[PDF] longtemps j ai pris ma plume pour une épée plan
[PDF] on ne touche pas ici