DistanceDevelopment / mrds

R package for mark-recapture-distance-sampling analysis
GNU General Public License v3.0
4 stars 4 forks source link

Plotting `rem.fi` models when there is truncation #58

Closed dill closed 2 years ago

dill commented 2 years ago

Per this Distance for Windows bug.

The MRE is:

library(mrds)

data(ptdata.removal)

x<-ddf(mrmodel = ~glm(~distance + person), 
       method="rem.fi", data = ptdata.removal,
       meta.data=list(width = 80))

plot(x)

Looks like there was an issue in plot_uncond()/plot_cond() where the data passed to hist() and points() was not truncated.

dill commented 2 years ago

Fix in this commit.

LHMarshall commented 2 years ago

that last fix seems to have now broken io plotting

library(mrds)
data(book.tee.data)
egdata <- book.tee.data$book.tee.dataframe
result.io <- ddf(dsmodel=~cds(key = "hn"),
  mrmodel=~glm(~distance),
  data=egdata, method="io",
  meta.data=list(width=4))
plot(result.io, pages = 1)

Error in xy.coords(x, y) : 'x' and 'y' lengths differ

8.stop("'x' and 'y' lengths differ")
7.xy.coords(x, y)
6.plot.xy(xy.coords(x, y), type = type, ...)
5.points.default(selmat$distance, gxvalues * jitter.p, ...)
4.points(selmat$distance, gxvalues * jitter.p, ...) at plot_cond.R#77
3.plot_cond(1, data, gxvalues, model, nc, breaks, finebr = (width/divisions) * (0:divisions), showpoints, showlines, maintitle, ylim, angle = angle, density = density, col = col, jitter = jitter, xlab = xlab, ylab = ylab, subtitle = subtitle, ...) at plot.io.R#155
2.plot.io(result.io, pages = 1)
1.plot(result.io, pages = 1)
dill commented 2 years ago

whoops, this should be fixed now

On 25/08/2022 19:17, Laura Marshall wrote:

that last fix seems to have now broken io plotting

|library(mrds) data(book.tee.data) egdata <- book.tee.data$book.tee.dataframe result.io <- ddf(dsmodel=~cds(key = "hn"), mrmodel=~glm(~distance), data=egdata, method="io", meta.data=list(width=4)) plot(result.io, pages = 1) Error in xy.coords(x, y) : 'x' and 'y' lengths differ 8.stop("'x' and 'y' lengths differ") 7.xy.coords(x, y) 6.plot.xy(xy.coords(x, y), type = type, ...) 5.points.default(selmat$distance, gxvalues jitter.p, ...) 4.points(selmat$distance, gxvalues jitter.p, ...) at plot_cond.R#77 3.plot_cond(1, data, gxvalues, model, nc, breaks, finebr = (width/divisions) * (0:divisions), showpoints, showlines, maintitle, ylim, angle = angle, density = density, col = col, jitter = jitter, xlab = xlab, ylab = ylab, subtitle = subtitle, ...) at plot.io.R#155 2.plot.io(result.io, pages = 1) 1.plot(result.io, pages = 1) |

— Reply to this email directly, view it on GitHub https://github.com/DistanceDevelopment/mrds/issues/58#issuecomment-1227609972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAPILSIHR24Q25IJA5MGTV262CXANCNFSM57SQHXPQ. You are receiving this because you modified the open/close state.Message ID: @.***>

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/DistanceDevelopment/mrds/issues/58#issuecomment-1227609972", "url": "https://github.com/DistanceDevelopment/mrds/issues/58#issuecomment-1227609972", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]