[R-sig-eco] FW: Feather plots for oceanic currents
Levy, Yair
yair.levy at mow.vlaanderen.be
Mon Mar 18 18:02:22 CET 2013
Hi Justine,
I modified the feather.plot function creating a feather.plot2 function as coded here under. Using that one instead would produce a feather plot with x and y axis.
feather.plot2 <- function (r, theta, xpos, yref = 0, use.arrows = TRUE, col.refline = "lightgray",
fp.type = "s", main = "", xlab = "", ylab = "", xlabels = NULL,
...)
{
if (missing(xpos))
xpos <- 1:length(theta)
if (fp.type == "m")
theta <- 5 * pi/2 - theta
x <- r * cos(theta)
y <- r * sin(theta)
xmult <- diff(range(xpos))/(diff(range(y)) * 2)
x <- x * xmult
xlim <- range(c(xpos, x + xpos))
ylim <- range(c(y, yref))
oldpin <- par("pin")
xdiff <- xlim[2] - xlim[1]
ydiff <- ylim[2] - ylim[1]
plot(0, xlim = xlim, ylim = ylim, type = "n", main = main,
xlab = xlab, ylab = ylab, axes = TRUE, xaxt = "n")
box()
if (is.null(xlabels))
axis(1)
else axis(1, at = xpos, labels = xlabels)
abline(h = yref, col = col.refline)
if (use.arrows)
arrows(xpos, yref, xpos + x, y, length = 0.1, ...)
else segments(xpos, yref, xpos + x, y, ...)
par(pin = oldpin)
}
#Then You could apply the function as such:
feather.plot2(r,theta,xlabels=ensembles, main="ADCP feather plot",
xlab = "Ensembles", ylab = "Current speed", col.reflin = "white", fp.type = "m")
The result figure is visible in attachement.
Best regards,
Yaïr Levy
Onderzoeker
Vlaamse overheid
Departement Mobiliteit en Openbare Werken
Waterbouwkundig Laboratorium
Berchemlei 115 - 2140 Antwerpen
T. 03 224 61 89 - G. 0476 75 47 25 - F. 03 224 60 36
www.watlab.be
Before printing, think about the environment!
-----Oorspronkelijk bericht-----
Van: Diaz Justine [mailto:justine.diaz at imr.no]
Verzonden: lundi 18 mars 2013 14:39
Aan: Levy, Yair
Onderwerp: RE: [R-sig-eco] FW: Feather plots for oceanic currents
Hi Yair,
Preferably tomorrow, but at the very latest probably by the 25th.
Thanks for your help again!
Cheers,
Justine
-----Original Message-----
From: Levy, Yair [mailto:yair.levy at mow.vlaanderen.be]
Sent: 18. mars 2013 14:33
To: r-sig-ecology-bounces at r-project.org
Cc: Diaz Justine
Subject: RE: [R-sig-eco] FW: Feather plots for oceanic currents
Hi Justine,
I can probably answer you shortly, how soon do you need an answer?
Yaïr Levy
Onderzoeker
Vlaamse overheid
Departement Mobiliteit en Openbare Werken Waterbouwkundig Laboratorium Berchemlei 115 - 2140 Antwerpen T. 03 224 61 89 - G. 0476 75 47 25 - F. 03 224 60 36 www.watlab.be
P Before printing, think about the environment!
Yaïr Levy
-----Oorspronkelijk bericht-----
Van: r-sig-ecology-bounces at r-project.org [mailto:r-sig-ecology-bounces at r-project.org] Namens Diaz Justine
Verzonden: lundi 18 mars 2013 13:45
Aan: r-sig-ecology at r-project.org
Onderwerp: [R-sig-eco] FW: Feather plots for oceanic currents
From: Diaz Justine
Sent: 18. mars 2013 13:42
To: 'r-sig-ecology at r-project.org'
Subject: [R-sig-eco] Feather plots for oceanic currents
Hello all listers,
Previously I had some help with creating a feather plot for ADCP data. I was able to make the plot but the y axis is missing integers for the magnitude values. Huge thank you in advance!!!
R-syntax:
library(plotrix)
ADCP <- read.table("C:/Users/justine/Dropbox/Stats/ADCP Data/SE_USE2.txt", header=T,quote ="",row.names=NULL,
colClasses="numeric",skip=0,fill=TRUE,blank.lines.skip=TRUE,comment.char="")
r <- ADCP[, 7]
theta <- ADCP[, 7] * pi / 180
ensembles <- ADCP[, 1]
feather.plot(r,theta,xlabels=ensembles, main="ADCP feather plot", xlab = "Ensembles (10 min averages)", ylab = "Magnitude (m/s)", col.reflin = "white", fp.type = "m")
Sample data set:
Ens
HH
MM
SS
HH
Mag
Dir
550
12
56
40
48
234
61.4
551
13
6
38
69
278
54.1
552
13
16
38
52
259
58.4
553
13
26
41
80
221
324.9
554
13
36
37
56
395
71.6
555
13
46
40
64
198
68.4
556
13
56
38
64
226
334.3
557
14
6
36
64
235
51.6
558
14
16
42
16
194
55.7
559
14
26
39
55
140
78
560
14
36
37
14
150
60.9
561
14
46
38
59
86
48.3
562
14
56
37
61
33
327.3
563
15
6
39
88
54
212.8
564
15
16
40
11
49
144.1
565
15
26
38
11
80
85
566
15
36
39
16
73
195.9
567
15
46
38
98
78
192.6
568
15
56
39
63
149
191.2
569
16
6
38
84
270
186.4
570
16
16
39
69
327
191.7
571
16
26
40
53
365
191.2
572
16
36
40
56
342
201.8
573
16
46
37
75
341
209.1
574
16
56
41
23
308
216.7
575
17
6
38
22
299
228.8
576
17
16
39
88
259
245.8
577
17
26
37
27
247
264.9
578
17
36
36
89
200
275.2
579
17
46
40
38
197
298.1
580
17
56
36
95
170
298.8
581
18
6
41
5
170
297.8
582
18
16
41
28
208
306.2
583
18
26
37
25
106
310.4
584
18
36
39
11
63
224.4
585
18
46
37
72
86
269.3
586
18
56
38
16
149
273.5
587
19
6
38
19
89
244.6
588
19
16
37
81
18
247.6
589
19
26
40
28
122
200.1
590
19
36
36
86
206
191.7
591
19
46
38
11
246
211.4
592
19
56
38
34
516
258.5
593
20
6
41
63
110
179
594
20
16
37
39
179
188.4
595
20
26
37
63
263
211.3
596
20
36
41
72
152
200
597
20
46
40
33
157
188.4
598
20
56
38
13
214
185.6
599
21
6
36
94
230
169.7
600
21
16
37
78
179
164.1
601
21
26
40
5
150
154.3
602
21
36
37
23
154
206.2
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
More information about the R-sig-ecology
mailing list