For more context, please read the function documentation and refer to the documentation of the companion package, {asar}.
When a plotting function (e.g., plot_biomass(),
table_indices(), save_all_plots()) is run,
placeholders within the plot’s associated alt text and captions are
replaced with key quantities (see the {asar}
package’s Accessibility vignette and the {stockplotr} “How
captions and alternative text are generated” vignette for more
details).
As stated in the Accessibility vignette’s “Your to-do list” section, you should always:
1. Check that these alt texts and captions have been assembled correctly.
2. Write the final component of each figure’s alt text.
Directly edit the rda’s caption or alt_text objects. To do so, assign a new value to the text you wish to change. For example:
Locate your rda file. It may be called something like “biomass_figure.rda”.
Load it into your R environment. You can do this by clicking the
file or by using a command like this:
load("biomass_figure.rda"). It will probably be called
rda.
If you want to change the caption to “my new caption”, you’d
enter the following command:
rda[["caption"]] <- "my new caption". To change the alt
text, you’d change “caption” to “alt_text” (e.g.,
rda[["alt_text"]] <- "my new alt text".).
Save the changes to the rda’s file (most likely you’ll want to
overwrite your original rda) by entering the following command:
save(rda, file = 'biomass_figure.rda').
No. When you export a figure or table as an rda, key quantities are calculated and inserted into its associated caption and alt text. If you regenerate a figure or table, its caption and alt text won’t change.
plot_biomass())
Open your caps_alt_text.csv file. Find the row where the “label”
column is the name of the plotting function, minus the “plot_” or
“table_”, and delete the row. For example, the label for
plot_biomass() is “biomass”.
Open the inst/resources/captions_alt_text_template.csv file. Find the same row and copy it.
Paste the row into the caps_alt_text.csv file.
Rerun the function so that the key quantities are newly calculated and added to the caps_alt_text.csv file.
save_all_plots())
Delete the captions_alt_text.csv file
Rerun save_all_plots()
NOTE: It is possible to directly edit the
captions_alt_text.csv file to change the caption or alt text. However,
if you wish to do anything besides adding or removing text, we recommend
using the two-step workflow, above, to avoid potential issues where an
incorrect argument was used to calculate other (now incorrect) key
quantities. For instance, end_year may be used to calculate
values associated with F, which are then used to calculate other
values.