Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify jnd2xyz() with base::cmdscale() #230

Open
Bisaloo opened this issue Apr 27, 2021 · 1 comment
Open

Simplify jnd2xyz() with base::cmdscale() #230

Bisaloo opened this issue Apr 27, 2021 · 1 comment

Comments

@Bisaloo
Copy link
Collaborator

Bisaloo commented Apr 27, 2021

We talking about this but opening an issue here for memory and in case someone wants to chime in:

library(pavo)
#> Welcome to pavo 2! Take a look at the latest features (and update your bibliography) in our recent publication: Maia R., Gruson H., Endler J. A., White T. E. (2019) pavo 2: new tools for the spectral and spatial analysis of colour in R. Methods in Ecology and Evolution, 10, 1097-1107.

data(flowers)
vis.flowers <- vismodel(flowers, visual = "apis")
cd.flowers <- coldist(vis.flowers, n = c(1,1,1))
#> Quantum catch are relative, distances may not be meaningful
#> Calculating noise-weighted Euclidean distances

# Current method
pavo_xyz <- jnd2xyz(cd.flowers)
plot(pavo_xyz, asp = 1)

# Base method
base_xyz <- cmdscale(coldist2mat(cd.flowers)[[1]], k = 2)
plot(base_xyz[, 1], base_xyz[, 2], asp = 1)

# Base method only rotates the output compared to the current method
base_xyz <- base_xyz * -1
plot(pavo_xyz, asp = 1)
plot(base_xyz[, 1], base_xyz[, 2], asp = 1)

Created on 2021-04-27 by the reprex package (v2.0.0.9000)

@Bisaloo
Copy link
Collaborator Author

Bisaloo commented Apr 29, 2021

As Tom mentioned, we now need to figure out how we can transpose the current rotational options with the framework proposed in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant