----- Forwarded message from Ray Danner <[email protected]> -----

Date: Wed, 19 Jun 2013 16:34:08 -0400
From: Ray Danner <[email protected]>
Reply-To: Ray Danner <[email protected]>
Subject: Re: geomorph curves2d plotting issue
To: [email protected]

Dean Adams solved the problem: 

1: copy the function curves2d into a new r script and rename it, say curves2d2()

2: locate the ‘lm’ line and change it to:

lm <- matrix(lm, ncol = dim(lm)[2], byrow=T)


So, it should look like this:


curves2d2<-function (file, nsliders) 

{

    lm <- readland.nts(spec.name <- basename(file))

    lm <- matrix(lm, ncol = dim(lm)[2], byrow=T)

    spec.name <- unlist(strsplit(spec.name, "\\."))[1]

    plot(lm[, 1], lm[, 2], cex = 1, pch = 21, bg = "white")

    text(lm[, 1], lm[, 2], label = paste("LM", 1:dim(lm)[1]), 

        adj = 0.5, pos = 1)

    selected <- matrix(NA, ncol = 3, nrow = nsliders)

    select <- NULL

    for (i in 1:nsliders) {

        for (j in 1:3) {

            select <- identify(lm, n = 1, plot = FALSE, cex = 5, 

                pch = 25)

            selected[i, j] <- select

            if (j == 2) {

                points(lm[select, ][1], lm[select, ][2], cex = 1.5, 

                  pch = 19, col = "red")

                arrows(lm[selected[i, j], ][1], lm[selected[i, 

                  j], ][2], lm[selected[i, j - 1], ][1], lm[selected[i, 

                  j - 1], ][2], col = "red", lwd = 2, length = 0.15)

            }

            else {

                points(lm[select, ][1], lm[select, ][2], cex = 1.1, 

                  pch = 19, col = "blue")

            }

            if (j == 3) {

                arrows(lm[selected[i, j], ][1], lm[selected[i, 

                  j], ][2], lm[selected[i, j - 1], ][1], lm[selected[i, 

                  j - 1], ][2], col = "red", lwd = 2, length = 0.15, 

                  code = 1)

            }

            else {

                NA

            }

        }

    }

    output <- selected

    cat(paste("\"sliders", sep = ""), file = paste("sliders.nts", 

        sep = ""), sep = "\n")

    cat(paste(1, dim(output)[1], 3, 0, "dim=3"), file = "sliders.nts", 

        sep = "\n", append = TRUE)

    write.table(output, file = "sliders.nts", col.names = FALSE, 

        row.names = FALSE, sep = "  ", append = TRUE)

    return(list(sliders = output))

}





On Wed, Jun 19, 2013 at 4:11 PM, <[email protected]> wrote:


----- Forwarded message from Ray Danner <[email protected]> -----

Date: Wed, 19 Jun 2013 13:50:49 -0400
From: Ray Danner <[email protected]>
Reply-To: Ray Danner <[email protected]>
Subject: geomorph curves2d plotting issue
To: [email protected]

Hi all,

First, I would like to thank the creators of the geomorph package for R!

The function curves2d appears to plot landmarks incorrectly.  I'm using geomorph version 1.1-1 with R 3.0.1.  The first few landmarks are plotted in the correct locations, but the others appear to have x and y values switched or values switched between landmarks.  Has anyone else found this?  I would provide an example, but curves2d calls .nts files and I'm not sure how to provide one for you all.

Thanks in advance,
Ray

--
Raymond M Danner, PhD
Postdoctoral Fellow
Smithsonian Migratory Bird Center
National Zoological Park



----- End forwarded message -----






--
Raymond M Danner, PhD
Postdoctoral Fellow
Smithsonian Migratory Bird Center
National Zoological Park



----- End forwarded message -----



Reply via email to