Allow users to input their own colour schemes, fixes for problems with >9 groups.#189
Open
quantixed wants to merge 5 commits intoACCLAB:masterfrom
Open
Allow users to input their own colour schemes, fixes for problems with >9 groups.#189quantixed wants to merge 5 commits intoACCLAB:masterfrom
quantixed wants to merge 5 commits intoACCLAB:masterfrom
Conversation
Mirror of PR from marsiwiec
…shared levels found..."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is an enhancement to
{dabestr}and fixes a couple of issues with colouringdabest_plots.dabest_plotwith more than 9 groups is requested, resulting plot is missing bars (issue This manual palette can handle a maximum of 10 values. You have supplied 12 #175)dabest_plotwith more than 9 groups is requested, colour scheme is broken (issue This manual palette can handle a maximum of 10 values. You have supplied 12 #175)dabest_plotwith more than n groups is requested, plot creation fails (where n is the maximum colours in custom palette, issue This manual palette can handle a maximum of 10 values. You have supplied 12 #175).I also merged the changes from marsiwiec which fixes the formatting of the print statements and adds an option to silence the greeting.
Issues (MWE)
Using the current version of
{dabestr}the following code illustrates the issues:With the proposed changes, the last four commands all work correctly.
The enhancement I am proposing is to add manual colouring to the graphics.
Briefly, the issue with groups exceeding the maximum in the palette is solved by a check which uses default ggplot2 colours if the palette is exceeded.
The issue of more than 9 groups causing errors was fixed by factoring the x positions so that they are in numeric order (i.e. 10 follows 9 rather than 1). However this also required naming the palette so that it can be applied correctly to Cumming plots (as these have missing categories). This choice meant that
apply_palette()had to be rewritten. The only alternative would've been to manually colour each bar and violin as is done for the text markers and this felt too hacky to be a solution.