---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- # We use pointO, pointV and pointD to draw the points in various forms; # Dot draws pixels, pointlike dots (see here). # rain: millimetres per month in a period of three years, in a given locality mm <- c(44, 59, 75, 80,96,98,97,99,100,102,104,101, 103,102,108,100,92,71,49,28, 27, 45,66, 81, 92,99, 93, 85, 75,67,61,62, 64, 68,71, 72) HF=3.5; BF=3.5; BOXW(-110,110, -110,110) for(i in 1:4) circl(0,0, i*25, "grey60") for(i in 1:12) Directio(0,0, i*30, 100, "grey60") ang <- seq(30,30*12*3,30) polyline(xrot(ang)*mm,yrot(ang)*mm,"blue") A1 <- ang[1:12]; A2 <- ang[13:24]; A3 <- ang[25:36] mm1 <- mm[1:12]; mm2 <- mm[13:24]; mm3 <- mm[25:36] pointO(xrot(A1)*mm1,yrot(A1)*mm1,"black") pointD(xrot(A2)*mm2,yrot(A2)*mm2,"black") pointV(xrot(A3)*mm3,yrot(A3)*mm3,"black") text(xrot(ang[1]+5)*115,yrot(ang[1]+5)*115,"Ja") text(xrot(ang[4]+5)*115,yrot(ang[4]+5)*115,"Ap") text(xrot(ang[7]+5)*115,yrot(ang[7]+5)*115,"Ju") text(xrot(ang[10]+5)*115,yrot(ang[10]+5)*115,"Oc") # geographic co-ordinates, density of population of some italian regions (= districts) # es.: 0.117208*10^6 popul., area 3262 in km^2 (year: 1991) # (each disk represents three data: the population density and the two geographic # coordinates of the chief town) CIRCLE = function(x,cit) {r <- sqrt(x[3])/25; circl(x[1],x[2],r,"red"); text(x[1],x[2],cit,font=2) } PLANE(7,14, 41.3,46.5) aosta <- c(7.31,45.75,0.117208*10^6/3262) trentino <- c(11.12,46.08,0.934731*10^6/13618) piemonte <- c(7.68,45.08,4.338*10^6/25399) lombardia <- c(9.17,45.47,8.941*10^6/23859) veneto <- c(12.33,45.43,4.453*10^6/18364) liguria <- c(8.93,44.42,1.702*10^6/5418) toscana <- c(11.24,43.78,3.599*10^6/22992) e_romagna <- c(11.34,44.5,3.984*10^6/22123) umbria <- c(12.39,43.11,0.822972*10^6/8456) marche <- c(13.5,43.6,1.447*10^6/9693) lazio <- c(12.5,41.89,5.146*10^6/17203) CIRCLE(aosta,"ao"); CIRCLE(trentino,"tr"); CIRCLE(piemonte,"pi") CIRCLE(veneto,"ve"); CIRCLE(lombardia,"lo"); CIRCLE(liguria,"li") CIRCLE(toscana,"to"); CIRCLE(e_romagna,"er"); CIRCLE(umbria,"um") CIRCLE(marche,"ma"); CIRCLE(lazio,"la") # Using the generate random numbers runif(n,A,B) that generates n random numbers # "uniformly" distributed from A to B (see here) I can compare population densities BF=2.5; HF=2.5 m=-0.5; M=10.5 PLANEww(m,M, m,M) polyl(c(m,M,M,m,m), c(m,m,M,M,m),"brown") aosta = 0.117208*10^6/3262; aosta # 35.93133 liguria = 1.702*10^6/5418; liguria # 314.1381 for(i in 1:round(aosta) ) Point(runif(1,0,10),runif(1,0,10),"blue") underx("val d'aosta") PLANEww(m,M, m,M) polyl(c(m,M,M,m,m), c(m,m,M,M,m),"brown") for(i in 1:round(liguria) ) Point(runif(1,0,10),runif(1,0,10),"blue") underx("liguria") # If I want, with ColPoint I can change the colors of the "points". W # With ColPoint = NULL I have no color. HF=3.5; BF=3.5; BOXW(-110,110, -110,110) for(i in 1:4) circl(0,0, i*25, "grey60") for(i in 1:12) Directio(0,0, i*30, 100, "grey60") ang <- seq(30,30*12*3,30) polyline(xrot(ang)*mm,yrot(ang)*mm,"blue") A1 <- ang[1:12]; A2 <- ang[13:24]; A3 <- ang[25:36] mm1 <- mm[1:12]; mm2 <- mm[13:24]; mm3 <- mm[25:36] ColPoint="red"; pointO(xrot(A1)*mm1,yrot(A1)*mm1,"black") ColPoint="yellow"; pointD(xrot(A2)*mm2,yrot(A2)*mm2,"black") ColPoint="green"; pointV(xrot(A3)*mm3,yrot(A3)*mm3,"black") text(xrot(ang[1]+5)*115,yrot(ang[1]+5)*115,"Ja") text(xrot(ang[4]+5)*115,yrot(ang[4]+5)*115,"Ap") text(xrot(ang[7]+5)*115,yrot(ang[7]+5)*115,"Ju") text(xrot(ang[10]+5)*115,yrot(ang[10]+5)*115,"Oc") Other examples of use