timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

Plot option to label ages not beginning with 1 #26

Closed Charles-Adams-NOAA closed 4 years ago

Charles-Adams-NOAA commented 4 years ago

Add an option to label the automated plots with the actual ages

brianstock-NOAA commented 4 years ago

Tim wrote all the plot functions to use an ages.lab argument... but this is created and stored in the model object on line 1057 of prepare_wham_input and defaults to 1:n.ages:

ages.lab = paste0(1:data$n_ages, c(rep("",data$n_ages-1),"+"))

Since I don't see an age label argument in ASAP3 files, we need to allow a user to specify this in prepare_wham_input via a plot.opts list argument or some such. For now, after the input list is created, a user can manually do this, e.g.

input$ages.lab = 0:(n.ages-1)
timjmiller commented 4 years ago

Maybe the simplest thing would be to add an ages.lab option to plot_wham_output and change mod$ages.lab to this within the function before passing mod to all of the internal plotting functions.

On Tue, Oct 6, 2020 at 2:20 PM Brian Stock notifications@github.com wrote:

Tim wrote all the plot functions to use an ages.lab argument... but this is created and stored in the model object on line 1057 https://github.com/timjmiller/wham/blob/master/R/prepare_wham_input.R#L1057 of prepare_wham_input and defaults to 1:n.ages:

ages.lab = paste0(1:data$n_ages, c(rep("",data$n_ages-1),"+"))

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/26#issuecomment-704460836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIGN7AKANM3HABMJG3HURTSJNNVJANCNFSM4SGJ3TSA .

-- Timothy J. Miller, PhD Research Fishery Biologist NOAA, Northeast Fisheries Science Center Woods Hole, MA 508-495-2365

brianstock-NOAA commented 4 years ago

I like that, will do. There will probably be other options that may need to be specified, so I'll add ages.lab as an entry in a plot.opts list which we can expand in the future.

brianstock-NOAA commented 4 years ago

You should be able to manually specify age labels now. E.g. replace this line in Ex 1 with:

plot_wham_output(mod=m4_proj, out.type='html', plot.opts=list(ages.lab = c("0","1","2","3","4","5+")))

I did not write any code to catch errors (yet).