-
Notifications
You must be signed in to change notification settings - Fork 5
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
extend subset parameter to all biplot layers #38
Comments
@jtr13, since you've used the package (and i'm so glad you've found it useful!), i'd be glad for your opinion. From the bulleted list above, what data would you expect to have to give |
Happy to give an opinion... I assume by row names you mean the column names of the original data frame. I (always) prefer character vectors of names but not critical if there are other considerations. |
Correct, when the data are provided as a data frame or matrix. Thank you! |
A draft solution is in the It is not understood by the other stat layers because, as implemented, the subsetting would affect the results of their calculations. The logistic PCA examples illustrate its use with numerical input, though logical and character inputs are also accepted. More examples, and unit tests, are needed, but this looks like a workable solution! |
Awesome! I'll give it a try and see if I can come up with some examples. |
Contributions are never obligatory but always welcome. Especially bug reports. |
Good to know! |
Works for me with integers but not characters...I'm not sure what the right syntax is. In the finches example With
And with
As an aside, imho there are an overwhelming number of geoms in the package. I'd prefer for example for |
@jtr13 try using Though i should make the warning message clearer. |
Never mind! I can reproduce the error after |
Commit a505a86 in the Please let me know again whether it works! Note: This is not an ideal solution. A better one would be to have a "pointer" (not in the low-level sense) to the original model object that has been cloaked in the 'tbl_ord' class. The ability to access this object from within 'tbl_ord' methods and within the ggplot2 build process would potentially solve many other problems. I'm leaving this issue open until a new one is created for this goal. |
Sorry my fault for not providing a full reprex showing that I was using # site-species data frame of Sanderson Galapagos finches data
library(ordr)
#> Loading required package: ggplot2
library(magrittr)
data(finches, package = "cooccur")
finches %>% t() %>%
logisticPCA_ord() %>%
as_tbl_ord() -> finches_lpca
finches_lpca %>%
augment_ord() %>%
ggbiplot(aes(label = .name), sec.axes = "cols", scale.factor = 50) +
geom_rows_text_radiate(subset = "Isabella") +
geom_rows_axis(subset = "Isabella", color = "royalblue3", lwd = .75) +
geom_rows_axis_text(size = 3, subset = "Isabella", color = "royalblue3",
label_dodge = 2) +
geom_rows_axis_ticks(subset = "Isabella", color = "royalblue3") +
geom_rows_vector(color = "darkred") +
geom_cols_point(alpha = .5, color = "royalblue3") +
ggtitle(
"Logistic PCA of the Galapagos island finches",
"Islands (finches) scaled to the primary (secondary) axes"
) +
expand_limits(x = c(-30, 25)) Created on 2021-08-29 by the reprex package (v2.0.1) Now to be super picky, it doesn't seem that there's a |
No apologies... thanks for the heads-up! |
The experimental
subset
parameter ofGeomIsolines$setup_data()
should be extended to all plot layers.To consistently distinguish between
ggplot()
andggbiplot()
, it would be good, if possible, to enable this parameter only for*_rows_*()
and*_cols_*()
layers. (Should it be a parameter ofstat_rows()
,stat_cols()
, and the other new stat layers rather than ofGeom*$setup_data()
?)An important decision is what inputs
subset
should be able to handle. Among the possibilities:[.data.frame()
anddplyr::slice()
but not bysubset()
; almost definitely worth including since it will come most naturally to users[.data.frame()
andsubset()
but not bydplyr::slice()
; should not cause confusion, but could just be required to bewhich()
ed instead of handled separately[.data.frame()
but not bysubset()
ordplyr::slice()
; could cause confusion becauseprint.tbl_ord()
uses tibble-like printing, which does not display row names asprint.data.frame()
does, but might be important for large data workflowsThe text was updated successfully, but these errors were encountered: