-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix boxplot colour group bug #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an example of using the feature
Also, check if any of the bugs are in related functions (create.violinplot, create.stripplot)
R/create.boxplot.R
Outdated
pch = points.info$pch, | ||
col = points.info$col, | ||
groups = points.info$groups, | ||
subscripts = if (!is.null(points.info$groups)) subscripts else NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this work with the flow-control {}, so something like { subscripts; } else { NULL; } If so, that's preferred, otherwise all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an example of using the feature
Also, check if any of the bugs are in related functions (create.violinplot, create.stripplot)
Related functions (stripplot, violinplot, scatterplot) work when a group variable is passed normally. The boxplot is a slightly different case because it is a combination of two plots, and the groups needed to be handled differently for the stripplot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fix also allow unique text labels to be applied to each panel?
(Trevor attempted this earlier: #5 )
This just fixes the colours. We thought it would be more manageable to put the two features in separate pull requests to begin with. |
- Grouping is only needed when the formula contains a conditional split (e.g. score ~ sex | gene). - Passing the colours as the groups argument had inconsistent results. Changing the group to use the x column from the given data was more stable. - This required parsing the formula, and works when the data is split with |. - Now does not need a full colour vector to be passed, just a colour scheme (though the full vector will also work with unique function).
I found some inconsistencies when testing this with different datasets. When the formula uses a conditional split (e.g. For the use case in issue #4, @alkaZeltser used a colour vector the same length as the data, with each colour value corresponding to a specific point. When groups are specified, lattice interprets the colours as a colour scheme, assigning the first 2 colour values to the groups, and ignoring the rest of the vector. This is a problem if, for example, the first two rows of the data happen to be male, both plots will be blue. This is the behaviour of lattice, not BPG. (I tested this with lattice outside of BPG and had the same results.) In this case (with a conditional split in the function), the plot should be passed a colour scheme (e.g. |
I think with these approvals, this is ready to merge. This passes |
Fixes problem with boxplot
points.col
in Issue #4 with lattice group/subscript arguments.