Revisão | b5df8df897105669b6e64a1d2eac721facf8bdfb (tree) |
---|---|
Hora | 2007-07-29 19:22:30 |
Autor | iselllo |
Commiter | iselllo |
I added the code 3D_R_plotting.R which correctly uses the lattice
package for 3D plots in R and properly save the figure in a file.
@@ -0,0 +1,73 @@ | ||
1 | +rm(list=ls()) | |
2 | +library(lattice) | |
3 | +data_150<-matrix(scan("y_complete00100"),ncol=100,byrow=T) | |
4 | +print("Ok reading the data") | |
5 | +data_150<-as.matrix(data_150) | |
6 | + | |
7 | + | |
8 | +D_mean<-read.table("D_mean_seq",header=FALSE) | |
9 | +D_mean<-as.matrix(D_mean) | |
10 | + | |
11 | + time<-read.table("time_grid", header=FALSE) | |
12 | +time<-as.matrix(time) | |
13 | + | |
14 | +t_len<-length(time) | |
15 | +t_seq<-seq(1:length(time)) | |
16 | + | |
17 | + | |
18 | +g <- expand.grid(x = D_mean, y = sort(time,decreasing=FALSE)) | |
19 | + | |
20 | +lentot<-length(D_mean)*length(time) | |
21 | +mydens<-seq(1,lentot) | |
22 | +# dim(mydens)<-c(lentot,1) | |
23 | +for (i in t_seq) | |
24 | +{j<-(i-1)*length(D_mean)+1 | |
25 | +mydens[j:(j+length(D_mean)-1)]<-data_150[i, ] | |
26 | +} | |
27 | + | |
28 | +g$z<-mydens | |
29 | + | |
30 | +# myfig_old<-wireframe(z ~ x * y, g, drape = TRUE,shade=TRUE, | |
31 | +# scales = list(arrows = FALSE),pretty=FALSE, aspect = c(1,1), colorkey = TRUE | |
32 | +# ,zoom=1, main=expression("Evolution Size Distribution"), zlab = list(expression("density"),rot =90),distance=0.0 | |
33 | +# ,xlab = list(expression("log(D_p [nm])"),rot =0), | |
34 | +# ylab = list(expression("Time [s]"),rot =0), | |
35 | +# perspective=TRUE,screen = list(z = 200, x = -35,y= 00),cex.axis=2, | |
36 | +# ) | |
37 | + | |
38 | +# trellis.device(pdf, | |
39 | +# file="evolution-3D-size-distribution_old.pdf") | |
40 | +# trellis.par.set("axis.line", | |
41 | +# list(col="transparent")) | |
42 | +# print(myfig_old) | |
43 | +# dev.off() | |
44 | + | |
45 | +# , at = c(5,10,30, 50, 100, 250, 500) | |
46 | + | |
47 | + | |
48 | + | |
49 | +myfig<-wireframe(z ~ x * y, g,font = 3, tck = 1,screen = list(z = 180, x = -80, y=0),colorkey = FALSE, xlab = expression(paste(D[agg]," [nm]")), | |
50 | + ylab = expression(paste(tau ," [s]")), | |
51 | + zlab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]")),rot=90), | |
52 | +scales = list(arrows = FALSE,cex= 0.7, col = "black",font = 1, tck = 0.8,x=list(log = TRUE, at = c(5,10,30, 50, 100, 250, 500))), shade=TRUE, | |
53 | + light.source= c(10,10,10), shade.colors = function(irr, ref, | |
54 | + height, w = 0.4) | |
55 | + grey(w * irr + (1 - w) * | |
56 | + (1 - (1 - ref)^0.4)),aspect = c(1, 0.65)) | |
57 | + | |
58 | + | |
59 | + | |
60 | +# trellis.device(postscript, | |
61 | +# file="evolution-3D-size-distribution.ps",onefile = FALSE, paper = "special", | |
62 | +# horizontal = FALSE, width = 8, height = 6) | |
63 | + | |
64 | +trellis.device(pdf, | |
65 | + file="evolution-3D-size-distribution.pdf",onefile = FALSE, paper = "special" | |
66 | +, width = 8, height = 6) | |
67 | + | |
68 | +trellis.par.set("axis.line", | |
69 | + list(col="transparent")) | |
70 | + print(myfig) | |
71 | + dev.off() | |
72 | + | |
73 | +print("So far so good") | |
\ No newline at end of file |