0

I need to represent some data in a very specific way. Right now I have a factor "treatment" with 8 levels, and then for each level, 4 different values obtained in the experiment (let's call it "type" factor with levels c("a", "b", "c", "d"). I would like to represent a graph where I have all "treatment" levels with position dodge for "type" "a" and "b", and then I would like to stack "c" and "d" together.

I've tried to implement this solution with no success.

What I have enter image description here

What I want enter image description here

I'm pretty sure it's not gonna be possible to have it exactly like I need, but I can accept a close enough try.

Thanks! J.

iod
  • 7,412
  • 2
  • 17
  • 36
jpm92
  • 143
  • 1
  • 8
  • 2
    Hi there. When you say you haven't had success with the linked solution, what hasn't worked? What does your code look like? If you can post a reproducible example that would be useful. – Jaccar Oct 28 '19 at 12:37
  • Hi @Megan, maybe "tried to implement" wasn't the right choice of words. To be honest I don't know where to start. I just thought that code could help me, but the case here is different. In his case, one of the mutants only has one of the levels of the factor and I think that's how he is able to separate. I don't really know how to apply it here. – jpm92 Oct 28 '19 at 15:08
  • Having looked at the answer, I don't think it is that only one of each bars is stacked, it's that the x axis is numeric that differs critically from yours by the sounds of it. There might be answers that can help you here: https://stackoverflow.com/questions/12715635/ggplot2-bar-plot-with-both-stack-and-dodge. However I don't think it is part of the functionality, you have to use workarounds really. – Jaccar Oct 28 '19 at 16:25

0 Answers0