Skip to content

Commit

Permalink
ENH: Flip discrete color palette cycling
Browse files Browse the repository at this point in the history
Closes #111.
  • Loading branch information
fedarko committed Oct 1, 2020
1 parent 98118ec commit ec177f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion q2_taxa/assets/barplot/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export default function render(svg, colorScheme, xOrdering, dataMeta, barWidth)
const range = [];
const domain = [];
for (let i = 0; i < keys.length; i += 1) {
range.push(scheme.scheme[i % scheme.scheme.length]);
// Assign colors from the "end" of the color scheme, which causes the
// color scheme to consistently give the topmost value in the barplot the
// same color (https://github.com/qiime2/q2-taxa/issues/111)
range.push(scheme.scheme[(keys.length - 1 - i) % scheme.scheme.length]);
domain.push(i);
}
z = scaleOrdinal(range).domain(domain);
Expand Down

0 comments on commit ec177f1

Please sign in to comment.