You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-Add part in beginning of stockplotr section that mentions the input is a standardized output
-Interactive is not default to FALSE – change this note in the code chunk for the customization
-“Inhertied from a ggplot2” to “Inhertied from a ggplot2 geom"
-Change tables_dir → figures_dir into rda export sec
-Add code chunk to run create_figure_doc
Copy file name to clipboardExpand all lines: Curriculum/Day_3/day_3.qmd
+38-23Lines changed: 38 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ Break for issues
70
70
71
71
This package is an ongoing process to gather contributions in order to expand the number of pre-made tables and figures that can be incorporated into a stock assessment report. All objects are intended to be generalized and not specific to any region.
72
72
73
-
{stockplotr} also contains `convert_output()`: the function used to convert model results into a standardize output (as explained in a [previous section](https://nmfs-ost.github.io/workflows-workshop/Curriculum/Day_2/day_2.html#stockplotrconvert_output)).
73
+
{stockplotr} also contains `convert_output()`: the function used to convert model results into a standardized output (as explained in a [previous section](https://nmfs-ost.github.io/workflows-workshop/Curriculum/nsaw.html#stockplotrconvert_output)). This standardized output is the input for the {stockplotr} plotting functions, below (the `dat` argument).
74
74
75
75
The following table contains figures and tables that are available in {stockplotr}:
76
76
@@ -99,18 +99,18 @@ Each automated function returns either a `ggplot2` object (figure) or `gt` objec
99
99
100
100
Run the example below. It should result in a line graph showing biomass over time, including a reference line for the biomass unfished.
101
101
102
-
```{r}
102
+
```{r eval = FALSE}
103
103
stockplotr::plot_biomass(
104
-
dat = petrale,
105
-
geom = "line",
106
-
group = NULL,
107
-
facet = NULL,
108
-
ref_line = "unfished",
109
-
unit_label = "mt",
110
-
scale_amount = 1,
111
-
relative = FALSE,
112
-
interactive = TRUE,
113
-
module = NULL
104
+
dat = petrale, # dataset
105
+
geom = "line", # show a line graph
106
+
group = NULL, # don't group by sex, fleet, etc.
107
+
facet = NULL, # not faceting by any variable
108
+
ref_line = "unfished", # set reference line at unfished
109
+
unit_label = "mt", # unit label: metric tons
110
+
scale_amount = 1, # do not scale biomass
111
+
relative = FALSE, # show biomass, NOT relative biomass
112
+
interactive = TRUE, # prompt user for MODULE_NAME in console
113
+
module = NULL # MODULE_NAME not specified here
114
114
)
115
115
```
116
116
@@ -136,20 +136,24 @@ stockplotr::plot_biomass(
136
136
geom = "line",
137
137
group = NULL,
138
138
facet = NULL,
139
-
ref_line = c("target" = 260),
139
+
ref_line = c("target" = 260), # changed from "unfished"
140
140
unit_label = "mt",
141
141
scale_amount = 1,
142
142
relative = FALSE,
143
-
# interactive = TRUE,
144
-
module = "TIME_SERIES"
143
+
interactive = FALSE, # changed from TRUE
144
+
module = "TIME_SERIES" # indicate module name here
145
145
)
146
146
```
147
147
148
148

149
149
150
150
#### Plot relative biomass and change the size of the line
151
151
152
-
In this example, we still are bypassing module selection and we are automatically extracting the reference line value from the data. However, now we are using this reference value to plot relative biomass and changing the linewidth to 2 (an argument inherited from `ggplot2`).
152
+
In this example, we still are bypassing module selection and we are automatically extracting the reference line value from the data. However, now we are using this reference value to plot relative biomass and changing the linewidth to 2 (an argument inherited from `ggplot2::geom_line()`).
153
+
154
+
::: {.callout-note}
155
+
If you were plotting a scatterplot (`geom = 'point'`) or area plot (`geom = 'area'`), you could add arguments associated with `geom_point()` and `geom_area()`, respectively.
156
+
:::
153
157
154
158
```{r}
155
159
stockplotr::plot_biomass(
@@ -160,10 +164,10 @@ stockplotr::plot_biomass(
160
164
ref_line = c("target" = 260),
161
165
unit_label = "mt",
162
166
scale_amount = 1,
163
-
relative = TRUE,
164
-
# interactive = TRUE,
167
+
relative = TRUE, # changed from FALSE
168
+
interactive = FALSE,
165
169
module = "TIME_SERIES",
166
-
linewidth = 2
170
+
linewidth = 2 # increase width of lines
167
171
)
168
172
```
169
173
@@ -183,11 +187,11 @@ stockplotr::plot_biomass(
183
187
geom = "line",
184
188
group = "none",
185
189
facet = NULL,
186
-
ref_line = NULL,
190
+
ref_line = NULL, # changed from c("target" = 260)
187
191
unit_label = "mt",
188
192
scale_amount = 1,
189
193
relative = FALSE,
190
-
# interactive = TRUE,
194
+
interactive = FALSE,
191
195
module = "TIME_SERIES"
192
196
)
193
197
```
@@ -212,7 +216,7 @@ stockplotr::plot_biomass(
212
216
unit_label = "mt",
213
217
scale_amount = 1,
214
218
relative = FALSE,
215
-
# interactive = TRUE,
219
+
interactive = FALSE,
216
220
module = "TIME_SERIES"
217
221
) +
218
222
ggplot2::geom_vline(xintercept = 2005, linetype = "dashed", color = "red")
@@ -315,7 +319,7 @@ stockplotr::plot_biomass(
315
319
unit_label = "mt",
316
320
module = "TIME_SERIES",
317
321
make_rda = TRUE,
318
-
tables_dir = getwd()
322
+
figures_dir = getwd()
319
323
)
320
324
```
321
325
@@ -434,6 +438,17 @@ Adding figures entails nearly the same process as described for tables. The only
434
438
1. Figures will involve captions and *alternative text*, whereas tables only require captions
435
439
2. Figures do not require the option to be rotated or split across pages.
Copy file name to clipboardExpand all lines: Curriculum/nsaw.qmd
+21-6Lines changed: 21 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -549,7 +549,7 @@ Learn about how to [call in previous reports](https://nmfs-ost.github.io/workflo
549
549
550
550
This package is an ongoing process to gather contributions in order to expand the number of pre-made tables and figures that can be incorporated into a stock assessment report. All objects are intended to be generalized and not specific to any region.
551
551
552
-
{stockplotr} also contains `convert_output()`: the function used to convert model results into a standardize output (as explained in a [previous section](https://nmfs-ost.github.io/workflows-workshop/Curriculum/nsaw.html#stockplotrconvert_output)).
552
+
{stockplotr} also contains `convert_output()`: the function used to convert model results into a standardized output (as explained in a [previous section](https://nmfs-ost.github.io/workflows-workshop/Curriculum/nsaw.html#stockplotrconvert_output)). This standardized output is the input for the {stockplotr} plotting functions, below (the `dat` argument).
553
553
554
554
The following table contains figures and tables that are available in {stockplotr}:
555
555
@@ -607,7 +607,7 @@ Here are some examples of how to customize the biomass figure:
607
607
608
608
#### Change the reference line to a specific value (e.g., 260)
609
609
610
-
In this example we are also telling the function which module to select in order to by-pass this step. We plan to remove grouping of some modules in the future.
610
+
In this example we are also telling the function which module to select in order to by-pass this step. We plan to remove grouping of some modules in the future.
611
611
612
612
```{r eval = FALSE}
613
613
stockplotr::plot_biomass(
@@ -619,7 +619,7 @@ stockplotr::plot_biomass(
619
619
unit_label = "mt",
620
620
scale_amount = 1,
621
621
relative = FALSE,
622
-
# interactive = TRUE, # commenting out this argument sets it to FALSE
622
+
interactive = FALSE, # changed from TRUE
623
623
module = "TIME_SERIES" # indicate module name here
624
624
)
625
625
```
@@ -628,7 +628,11 @@ stockplotr::plot_biomass(
628
628
629
629
#### Plot relative biomass and change the size of the line
630
630
631
-
In this example, we still are bypassing module selection and we are automatically extracting the reference line value from the data. However, now we are using this reference value to plot relative biomass and changing the linewidth to 2 (an argument inherited from `ggplot2`).
631
+
In this example, we still are bypassing module selection and we are automatically extracting the reference line value from the data. However, now we are using this reference value to plot relative biomass and changing the linewidth to 2 (an argument inherited from `ggplot2::geom_line()`).
632
+
633
+
::: {.callout-note}
634
+
If you were plotting a scatterplot (`geom = 'point'`) or area plot (`geom = 'area'`), you could add arguments associated with `geom_point()` and `geom_area()`, respectively.
635
+
:::
632
636
633
637
```{r eval = FALSE}
634
638
stockplotr::plot_biomass(
@@ -640,7 +644,7 @@ stockplotr::plot_biomass(
640
644
unit_label = "mt",
641
645
scale_amount = 1,
642
646
relative = TRUE, # changed from FALSE
643
-
# interactive = TRUE,
647
+
interactive = FALSE,
644
648
module = "TIME_SERIES",
645
649
linewidth = 2 # increase width of lines
646
650
)
@@ -704,7 +708,7 @@ stockplotr::plot_biomass(
704
708
unit_label = "mt",
705
709
module = "TIME_SERIES",
706
710
make_rda = TRUE,
707
-
tables_dir = getwd()
711
+
figures_dir = getwd()
708
712
)
709
713
```
710
714
@@ -795,6 +799,17 @@ Adding figures entails nearly the same process as described for tables. The only
795
799
1. Figures will involve captions and *alternative text*, whereas tables only require captions
796
800
2. Figures do not require the option to be rotated or split across pages.
0 commit comments