Closed altairwei closed 3 months ago
Thanks! (And sorry for the belated reply). Yes, this definitely seems like a bug. Thanks for the investigation and proposed fix. I, however, see some errors running the tests now:
11. ├─base::levels(strips$groups[[2]]) at eulerr/R/plot.euler.R|549| 5
12. ├─strips$groups[[2]] at eulerr/R/plot.euler.R|549| 5
13. └─base::`[[.data.frame`(strips$groups, 2) at eulerr/R/plot.euler.R|549| 5
|| 14. └─(function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x, ...
@jolars I apologize for the late reply. Recently, when I tried to split the data.frame
using only one variable and then call eulerr::euler
, I realized and understood the error you encountered in the tests. The latest commit fixes this case, but it requires the groups
to have column names; otherwise, we would need to write more code for logical operation.
Great, thanks a lot for the PR!
I encountered a problem with mismatched strips when using the
eulerr
package installed from CRAN. Here's the generated diagram:Upon examining the source code of
eulerr
, I noticed an issue in theplot.euler
method. Thepos
variable has the same data type as thegroups
variable. This means that the first column ofgroups
is interpreted aslayout.pos.row
and the second column aslayout.pos.col
. The relevant code that calculates the position of the grob object is as follows:While the plotting of strips used the
layout
correctly,strips$groups
was not used properly. Another observation is that the grob layout fills row by row, but strips start plotting from the bottom left. Hence, it's important to reverse the sequence of the left strips.Here's the final euler diagram with the fixed strips: