inlabru-org / inlabru

inlabru
https://inlabru-org.github.io/inlabru/
77 stars 21 forks source link

y-axis label for detection function plotting #20

Closed dill closed 6 years ago

dill commented 7 years ago

Plotting a fitted detection function, it seems the y-axis is currently labelled as "NA" rather than, say "Probability of detection" or somesuch.

Reprex (from tutorial example):

library(inlabru)
init.tutorial()
data(mrsea)
mdl = distance ~ beta.df(map=distance^2, model="linear") + Intercept
r = lgcp(mrsea$points, model = mdl)
pr = predict(r, distance ~ exp(beta.df * distance^2))
plot(pr)

Produces this plot:

screen shot 2017-03-22 at 12 10 05

finnlindgren commented 7 years ago

In the latest version (2.0.0) the output is different ("mean" instead of "NA"). Since predict doesn't know what the user is predicting (detection, log-detection, intensity, log-intensity, component, or other arbitrary function), there needs to be a user mechanism for helping with that. (There is likely a simple ggplot2 solution.)

fbachl commented 6 years ago

The user has to know what quantity he/she is predicting (calculating statistics for). The default statistic shown when using gg() is the mean. One could potentially automatically label the y axis by the formula used for predicting. However, the latter is usually a rather "messy" expression so I prefer that the user has to overwrite the label manuallly ( +xlab()).