Tabla de Contenidos

Gráficos con R

Funciones

Tamaño

Formas

plot(rep(1:5,5),sort(rep(1:5,5)),pch=25:1,cex=2,xlim=c(0,6),ylim=c(0,6))
text(rep(1:5,5),sort(rep(1:5,5)),1:25,pos=3)

Colores

plot(0:9,rep(1,10),pch=16,cex=8,col=0:8,xlim=c(-0.5,9.5),ylim=c(0,2),asp=1)
text(0:9,rep(1,10),0:9,pos=3,offset=2)

Varios gráficos en una misva ventana

par(mfrow=c(3,2))

par(mfrow=c(1,1))

Un ejemplo

x<-c(40.3, 88.8, 89.4, 53.8, 50.9, 66.4, 82.5, 54.0, 42.1, 68.3, 56.1,
74.0, 62.5, 95.9, 96.0, 96.4, 82.4, 38.0, 80.4, 90.1, 80.9, 66.7, 99.2,
93.9, 99.6, 83.9, 81.0, 46.1, 98.0, 82.3, 47.9, 56.5, 14.7, 81.3, 25.3,
95.7, 93.2, 89.4, 85.1, 78.9, 65.1, 88.9, 57.5, 75.2, 52.6, 96.8, 55.4,
65.9, 12.4, 32.5, 52.5, 80.5, 80.3, 65.8, 42.1, 47.2, 58.1, 95.2, 86.9,
39.1, 72.1, 63.7, 89.6, 96.3, 67.7, 50.8, 91.8, 75.8, 87.0, 10.4, 93.9,
65.6, 27.1, 69.8, 18.9, 77.2, 70.3, 74.6, 74.9, 39.3, 93.8, 42.4, 29.9,
62.6, 60.4, 50.7, 65.7, 56.1, 66.0, 49.7, 98.4, 78.8, 84.5, 76.1, 78.8,
57.7, 4.1, 48.4, 96.5, 39.3, 36.7, 62.6, 83.1, 24.0, 73.2, 54.2, 43.5,
69.1, 7.7, 59.5, 90.6, 94.5, 78.9, 74.8, 45.2, 63.1, 92.2, 90.6, 51.2,
75.9, 57.1, 95.0, 64.6, 84.2, 62.4, 65.7, 52.9, 76.5, 36.8, 94.6, 90.8,
67.9, 93.6, 63.7, 57.5, 99.1, 84.6, 59.8, 36.1, 93.5, 38.6, 66.7, 77.3,
20.0, 77.9, 58.3, 93.0, 99.7, 65.8, 92.2, 81.9, 76.2, 96.3, 85.1, 50.5,
62.8, 10.9, 59.2, 79.6, 91.3, 83.1, 37.9, 62.1, 60.6, 97.0, 74.1, 60.9,
52.2, 92.1, 77.9, 71.6, 40.2, 38.2, 36.2, 59.7, 23.3, 72.9, 96.2, 98.1,
30.2, 26.0, 65.2, 93.8, 48.3, 81.1, 15.3, 36.7, 75.8, 78.8, 35.3, 23.4,
92.5, 93.7, 90.1, 74.4, 79.4, 54.4, 99.9, 63.3, 92.9, 77.3, 59.2, 51.8,
28.3, 55.5, 26.5, 62.0, 98.7, 66.4, 61.9, 77.8, 46.0, 85.3, 99.1, 63.2,
60.6, 97.4, 77.5, 83.0, 87.7, 69.2, 95.5, 67.4, 94.4, 70.9, 27.9, 62.3,
68.6, 46.6, 80.0, 78.3, 80.9, 25.1, 38.3, 92.3, 82.2, 74.9, 90.1, 63.3,
69.6, 17.3, 99.5, 57.8, 26.9, 43.6, 55.6, 51.2, 82.0, 89.6, 45.2, 31.9,
78.5, 77.0, 56.8, 79.4, 85.0, 84.0, 31.3, 77.9, 26.5, 53.6, 56.9, 90.2,
22.6, 72.8, 69.9, 99.0, 91.7, 44.2, 80.4, 85.4, 71.8, 98.3, 90.2, 22.9,
69.6, 97.5, 75.2, 44.5, 84.7, 33.1, 92.9, 87.2, 80.8, 84.2, 88.5, 96.6,
68.0, 94.7, 94.2, 56.8, 93.0, 95.1, 92.3, 88.6, 89.2, 74.6, 59.2, 57.0,
94.9, 40.4, 13.6, 43.6, 81.0, 99.1, 54.8, 69.8, 85.8, 30.5, 50.2, 90.7,
91.6, 13.7, 3.5, 82.5, 64.5, 75.8, 46.5, 56.1, 6.7, 72.2, 46.3, 73.9,
16.5, 44.2, 31.5, 75.2, 8.1, 95.6, 35.9, 46.8, 32.3, 47.7, 65.7, 68.1,
89.7, 46.7, 59.6, 75.6, 37.8, 75.7, 29.7, 39.1, 72.7, 72.9, 32.6, 99.1,
47.2, 88.9, 31.1, 5.0, 75.4, 66.5, 97.9, 46.9, 62.4, 37.0, 60.1, 91.0,
69.9, 82.8, 74.5, 26.0, 94.9, 73.1, 64.8, 81.3, 62.1, 62.1, 95.7, 36.6,
51.2, 92.4, 29.0, 96.0, 90.2, 90.0, 81.2, 70.1, 58.5, 59.3, 38.9, 90.7,
92.1, 67.0, 79.8, 20.6, 40.5, 87.9, 62.2, 40.1, 90.2, 62.5, 16.3, 74.6,
86.4, 88.7, 12.3, 83.4, 22.7, 26.3, 83.5, 61.5)

y<-c(0.3, 0.3, 0.5, 0.6, 0.6, 1.0, 1.1, 1.2, 1.3, 1.9, 2.1, 2.2, 2.4,
2.4, 2.7, 2.8, 3.0, 3.3, 3.3, 3.5, 3.7, 3.7, 3.9, 4.5, 4.6, 4.6, 4.7,
4.7, 4.7, 5.1, 5.2, 5.4, 5.5, 5.6, 6.1, 6.5, 6.6, 6.9, 7.1, 7.2, 8.5,
8.6, 9.3, 9.4, 10.0, 10.4, 10.5, 10.8, 10.8, 11.1, 11.5, 12.2, 12.6,
12.9, 13.6, 14.0, 14.1, 14.3, 14.4, 14.5, 15.2, 15.2, 15.9, 16.1, 16.7,
17.3, 17.3, 17.4, 17.4, 17.4, 17.5, 17.5, 17.8, 18.8, 19.4, 19.4, 19.7,
20.3, 20.7, 20.8, 20.8, 20.8, 21.2, 21.5, 21.8, 22.0, 22.7, 22.7, 22.8,
22.9, 23.1, 23.2, 23.3, 23.3, 23.8, 24.0, 24.6, 24.6, 24.7, 25.2, 25.3,
25.5, 25.6, 25.8, 25.8, 25.8, 25.9, 26.3, 26.5, 26.6, 26.7, 27.5, 27.5,
27.6, 27.8, 27.9, 28.5, 28.8, 29.2, 29.6, 29.8, 29.8, 30.2, 30.3, 30.4,
30.5, 31.0, 31.1, 31.7, 31.9, 32.4, 32.7, 32.7, 33.1, 33.2, 33.4, 33.9,
34.0, 34.7, 35.3, 35.5, 35.5, 35.6, 35.7, 35.7, 35.7, 35.8, 36.0, 36.4,
36.7, 36.8, 36.9, 37.0, 37.0, 37.4, 37.6, 37.9, 38.0, 38.0, 38.4, 38.4,
39.0, 40.3, 40.6, 40.8, 41.1, 41.3, 41.6, 41.7, 42.0, 42.1, 42.2, 42.3,
42.4, 42.4, 42.6, 43.0, 43.3, 43.8, 44.1, 44.1, 44.4, 44.6, 45.0, 45.1,
46.3, 46.5, 47.5, 47.7, 47.8, 47.9, 48.1, 48.2, 48.3, 48.3, 48.5, 49.0,
49.2, 49.3, 49.6, 49.7, 50.3, 50.5, 50.9, 50.9, 51.2, 51.6, 51.9, 51.9,
52.3, 52.4, 52.8, 52.9, 53.0, 53.1, 53.2, 54.0, 54.0, 54.0, 54.1, 54.1,
54.2, 54.3, 54.4, 55.0, 55.0, 55.1, 55.2, 55.2, 55.3, 55.3, 55.3, 55.3,
55.4, 55.5, 55.5, 56.4, 56.5, 56.6, 57.4, 57.8, 58.0, 58.3, 58.4, 58.4,
58.4, 58.8, 58.9, 59.5, 59.6, 59.7, 60.0, 60.2, 60.2, 60.8, 61.4, 61.7,
61.9, 62.0, 62.0, 62.3, 62.4, 62.8, 63.1, 63.3, 63.4, 63.5, 63.5, 63.7,
63.9, 64.1, 64.3, 64.6, 64.6, 65.1, 65.2, 65.3, 65.5, 65.7, 66.0, 66.2,
66.3, 67.1, 67.5, 67.7, 68.3, 68.4, 68.6, 68.7, 68.9, 69.0, 69.2, 69.4,
69.5, 69.5, 69.6, 71.1, 71.5, 71.5, 71.9, 71.9, 72.4, 72.7, 73.2, 73.6,
73.8, 73.8, 73.8, 74.0, 74.2, 74.3, 74.5, 74.7, 74.8, 76.2, 76.4, 76.9,
77.2, 77.5, 77.5, 77.6, 77.6, 77.7, 78.2, 78.6, 78.9, 79.2, 79.3, 79.5,
79.5, 79.6, 79.7, 79.8, 80.3, 80.5, 80.8, 80.9, 81.3, 81.6, 81.8, 82.0,
82.3, 82.4, 83.4, 83.9, 84.2, 84.6, 84.6, 84.7, 85.0, 85.5, 85.9, 85.9,
86.2, 86.4, 86.4, 86.6, 86.9, 86.9, 87.4, 87.9, 88.1, 88.3, 88.3, 88.6,
89.1, 89.2, 89.3, 89.5, 89.6, 90.3, 90.4, 90.5, 90.6, 91.6, 92.2, 92.3,
92.4, 92.8, 93.3, 93.9, 93.9, 94.0, 94.5, 94.7, 95.0, 95.0, 95.7, 95.8,
96.2, 96.4, 96.7, 97.5, 98.1, 98.1, 98.3, 98.9, 98.9, 99.1, 99.5, 99.6,
99.8, 100.0)

plot (x,y,col=grey(0.8),pch=16,cex=0.5)
points(x,y,col=x>40 & x<60,pch=16,cex=0.5)
abline(v=c(40,60),col="pink")