/
seeRadiiData.Rmd
125 lines (86 loc) · 5.4 KB
/
seeRadiiData.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
title: "Visualize Points Selected on a Calcified Structure"
author: "Derek H. Ogle"
date: "`r Sys.Date()`"
output:
prettydoc::html_pretty:
theme: cayman
highlight: vignette
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# Introduction
A method for visualizing annular points that a user (or users) selected on a calcified structure is described in this vignette. This vignette assumes that you have an R data file or files created from selecting points on a calcified structure using `digitizeRadii()` as described in the [Collecting Radial Measurements](collectRadiiData.html) vignette. It also assumes that you understand the language and functions introducted in that vignette.
This vignette will use the following R data files:
* "Scale_1_DHO.rds": annular points selected on the "Scale_1.jpg" file in the [Collecting Radial Measurements](collectRadiiData.html) vignette.
* "Scale_1_ODH.rds": a second set of annular points selected on the "Scale_1.jpg" file in the [Collecting Radial Measurements](collectRadiiData.html) vignette.
* "Scale_1_OHD.rds": a third set of annular points selected on the "Scale_1.jpg" file in the [Collecting Radial Measurements](collectRadiiData.html) vignette.
* "Oto140306_DHO.rds": annular points selected on the "Oto140306.jpg" file. In contrast to the previous images, this image had a 1-mm scale-bar. This R data file was created with the following code.
```{r eval=FALSE}
digitizeRadii("Oto140306.jpg",id="140306",reading="DHO",
description="Used to demonstrate use of scale-bar.",
scaleBar=TRUE,scaleBarLength=1,edgeIsAnnulus=TRUE,
windowSize=12)
```
Only the `RFishBC` package is needed for this vignette.
```{r message=FALSE}
library(RFishBC)
```
\
\
----
# Visualize One Set of Annuli
You can review the selected annuli on a structure with `showDigitizedImage()`, which requires only the name of an R data file created from `digitizeRadii()`.[^sdifilename]
```{r eval=FALSE}
showDigitizedImage("Scale_1_DHO.rds")
```
![](Scale_1_A.jpg)
\
The plotting character, color, and relative size of the selected points may be changed with `pch.show=`, `col.show=`, and `cex.show=`, respectively. By default, the points are connected which will display as a linear transect if `makeTransect=TRUE` (the default) was used when selecting annuli in `digitizeRadii()`. The color and width of the connected lines may be changed with `col.connect=` and `lwd.connect=`. The connected lines may be excluded altogether with `connect=FALSE`. Annuli will be numbered if `showAnnuliLabels=TRUE` (the default) with label colors and relative size changed with `col.ann=` and `cex.ann=`, respectively. Annuli for which numbers are plotted may be controlled with `annuliLabels=` (e.g., only the first six plus several others after that are shown for the Kiyi otolith below). Defaults for all of these arguments may be set with `RFBCoptions()` as was demonstrated in the [Setting Arguments section of this vignette](collectRadiiData.html#setoptions1)
```{r eval=FALSE}
showDigitizedImage("Oto140306_DHO.rds",pch.show="+",col.show="blue",
col.connect="white",col.ann="black",cex.ann=1,
annuliLabels=c(1:6,8,10,13))
```
![](Oto140306_E.jpg)
\
You can also just show the points without the transect and individually control the color of the annuli labels.
```{r eval=FALSE}
showDigitizedImage("Oto140306_DHO.rds",annuliLabels=c(1:6,8,10,13),
connect=FALSE,col.ann=c(rep("black",8),"white"),cex.ann=1)
```
![](Oto140306_F.jpg)
\
\
----
# Visualize Multiple Readings of Same Structure
In some instances, you may be interested in visually comparing the selected points from multiple readings of the same structure. The `showDigitizedImage()` function can accomplish this if it is given a vector of R data file names created from the same structure.
The `listFiles()` function (described in the [Collecting Radial Measurements](collectRadiiData.html) vignette) may be used to identify all filenames in the current working directory that have the file extension given in the first argument. For example, all files with the "rds" extension are found below.
```{r}
listFiles("rds")
```
This list of names can be further filtered by including other key words for the filenames in `other=`. For example, all files with the "rds" extension that contain the keyword "Scale_1" are returned below. For our purposes here, these filenames are saved into an object (e.g., `fns`).
```{r}
( fns <- listFiles("rds",other="Scale_1") )
```
The multiple readings of "Scale_1" can be seen by giving this set of filenames to `showDigitizedImage()`.[^sdifilename2]
```{r eval=FALSE}
showDigitizedImage(fns)
```
![](Scale_1_B.jpg)
\
Aspects of the connecting lines and points may be controlled with arguments to `showDigitizedData()`. For example, the code below uses different colors for each set of connecting lines and points.
```{r eval=FALSE}
showDigitizedImage(fns,col.show=c("yellow","red","blue"),
col.connect=c("red","yellow","green"),lwd.connect=2)
```
![](Scale_1_C.jpg)
\
\
# Footnotes
[^sdifilename]: If no file name is given, then a dialog box will appear from which the data file can be selected. It is assumed that the file is in the current working directory.
[^sdifilename2]: If no file names are given, then a dialog box will appear from which multiple data files can be selected.