0

I have the following dataset in R, which I want to make into a mosaic plot using ggplot2 and ggmosaic.

type   variable count residuals residcut residround
see.m       aca    44  4.380270     high          4
see.nm      aca    26 -3.063712      low         -3
see.m      conv    48 -1.562652      low         -2
see.nm     conv   135  1.092973   medium          1
see.m       fic    27 -2.194561      low         -2
see.nm      fic    98  1.534951   medium          2
see.m      news    17  1.504522   medium          2
see.nm     news    19 -1.052315      low         -1

I am using the following code, which gives me the plot below :

ggplot(see.reg2) + geom_mosaic(aes(x = product(type, variable), weight = count, fill = type))

enter image description here

I am wondering if there is a possible way to change the way the tick marks on the bottom are done, so that I only see four ticks: one for each level of 'variable', rather than seeing eight tick marks (one for each interaction).

Thank you!

Marissa
  • 345
  • 1
  • 5
  • 17
  • The fill argument shown in the plot is type, not residcut. Running the code you posted but using type, as you've shown, gets me a plot with labels such as "aca", "conv", etc., not the ones you got. I'm on a development version of `ggmosaic`, 0.1.2.9000 – camille Aug 03 '18 at 17:36
  • Sorry camille! I meant to type in 'type' in the example code. I changed it in my question. Though I will add, when I include the fill = residcut, I also get interaction-type x axis tick marks, instead of the four I want. – Marissa Aug 03 '18 at 17:54
  • What version are you using? Because I don't get interaction tick marks – camille Aug 03 '18 at 18:02
  • I am using version 0.1.2. – Marissa Aug 03 '18 at 19:51
  • Try updating to the version on Github, because I'm not having the same problem with it – camille Aug 03 '18 at 20:01

0 Answers0