0

I am trying to create a mosaic plot using the VCD package, and wanted to know if I can change the labels on the plot, as the current ones are overlapping.

The data is from the behavioral risk factor surveillance system

I am using the following code:

mosaic(~income2+carercvd, data=brfss2013,
labeling=labeling_border(labels=TRUE, rot_labels = c(0,0),
just_labels = c("left","right")),set_labels=c("<10k","<15k","<20k","<25k","<35k","<50k","<75k",">75k"))

However, I am receiving the following output: Mosaic Plot

Can anyone help me fix my mosaic plot please?

  • Welcome to Stack Overflow. When you ask questions, you want to supply all necessary information (minimal sample data and your code) so that SO users can easily reproduce your case. Here, you want to tell SO users where one can get `brfss2013`. Otherewise, nobody can really replicate your graphic. Can you provide more information in your question? – jazzurro Dec 25 '19 at 11:49
  • Two things here: (i) you can use `\n` in defining the row names of your 2x2 table; that will introduce a line break at the specified point; (ii) you can at least get rid of the variable names (in bold) by setting the argument `varnames = F` in the function call to `mosaic` – Chris Ruehlemann Dec 25 '19 at 16:03
  • Thanks for the advice, I have edited to add my data source in the post. Chris, your comment is helpful, but I was hoping to change the labels to what I have listed in the set_labels part of my code. I am unsure of why it isn't changing despite my putting that parameter there. – Vikram Singh Dec 25 '19 at 21:41

0 Answers0