I wish this help you I have an issue where a grouped bar chart made with ggplot unintentionally transforms into a stacked bar chart after minor changes in my dataset. I have the following initial dataset and bar chart: , I'm going to guess that Round is not a factor in your data:
How to plot a Stacked and grouped bar chart in ggplot?
By : Aldo Omar
Date : March 29 2020, 07:55 AM
I hope this helps . Suppose you want to plot id as x-axis, side by side for the month, and stack different types, you can split data frame by month, and add a bar layer for each month, shift the x by an amount for the second month bars so they can be separated:
it should still fix some issue You can stack bar charts by setting the stacked option to true on the x- and y-axis and define stack group property of your datasets. Below is your snippet with the proposed changes:
seems to work fine Looking for something similar, I took a look on example you gave, and decide to write something. Rather than trying to fix the code or reusing the 'groupableBar', I get Chart.js code from Chart.controllers.horizontalBar and rewrite some part in functions calculateBarY, calculateBarHeight. Just reused the getBarCount function from your example.