Mosaic plots and image-plots use color and area in a 2-d discrete matrix to display "three way" categorical relationships.
Questions tagged [mosaic-plot]
76 questions
0
votes
1 answer
VDS/R: change order of mosaicplot
I made the following mosaicplot using this code, but as you can see, the order is wrong. -3 schould be on the left, followed by -2 & -1. I am confused as to what is causing this and would appreciate your help. Thank you very much in Advance…

Mr. Draro
- 77
- 4
0
votes
1 answer
VCD renaming label mosaicplot
I would like to rename my labels (both "Bildungsgrad" and "Bundestagswahl 2021" after having them situated via labeling_list. Currently, they just have there numeric values (see attached picture)Plot I tried both
set_labels=list(Bildungsgrad =…

Mr. Draro
- 77
- 4
0
votes
1 answer
How to make the mosaic plots of 20 dataframes and put them in one page in r?
I created 20 data frames in a loop already. And assigned them in the loop as below
for(x in 1:20){
my_file <- read.table(paste0("file_name",x), head=TRUE) %>%
select(Count, Total) %>%
data.frame()
assign(paste0("my_file_",x),…

candyuuu
- 1
0
votes
0 answers
Editing mosaic plot labels and axes values as shown on the example
I am a beginner in R and I need to reconstruct my mosaic plot from the data below.
The plot isn't quite what I imagined, the labeling is all wrong and I don't want to display the contingency table. I tried different lines to change the label but it…

Tizu
- 1
- 1
0
votes
1 answer
Reorder factor in mosaic plot in R with ggmosaic and geom_mosaic()
I have tried to familiarise myself with making mosaic plots in R with the ggmosaic package's geom_mosaic() command.
My problem is that I want the regions to be ordered by the share of seniors in each region, and not by name as now. Any help?
I am…

Torskelgen
- 1
- 2
0
votes
1 answer
I am trying to run mosaic on a band and at this stage while i am applying raster it is giving me this error
band1<-raster(B1)
Error in if (x == "" | x == ".") { : argument is of length zero
0
votes
1 answer
2x2 mosaic Viewport error: cell was not found
I am trying to plot percentages in a simple 2x2 contingency table with vcd::mosaic but I keep getting a Viewport error. Here is how to reproduce (I work on Ubunto 20.04 and R 3.6.3):
t0 <- as.table(rbind( c(221,47), c(17,9) ))
names(dimnames(t0)) =…

cccnrc
- 1,195
- 11
- 27
0
votes
1 answer
Visualizing 2x2 or 2x3 contingency tables using corrplot
I have a dataset from which I am trying to visualize a contingency table of ETH (ethnicity coded as 0 or 1) and SEX (sex coded as 0 or 1).
This is what my dataset looks like:
This is my coding in…

Zoya Qaiyum
- 19
- 5
0
votes
0 answers
How do you change the order of explanatory and response variables in a mosaic plot?
My work.
What I want.
How can I modify my R code so that my explanatory variables (Captured, Not Captured) are on the bottom part of my plot, the response variables (Captured, Not Captured) on the right side of my plot? My teacher is not accepting…

Tyler Brent de Leon
- 29
- 5
0
votes
0 answers
How to plot mosaic plot in python?
I'm trying to plot a mosaic plot on below dataframe, but it keeps sending error: 'ValueError: at least one proportion should be greater than zero'
here is the dataframe:
import numpy as np
import pandas as pd
import matplotlib
import…

Mahsaem
- 21
- 5
0
votes
0 answers
How can I change labels in the R VCD package in a mosaic plot?
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…

Vikram Singh
- 1
- 1
0
votes
0 answers
R mosaic() shade is not coloring the data
I have the following code:
#Loading libraries
library(grid)
library(vcd)
#creating table
ds = array(c(14,4,7, 10,15,9, 3,11,5), dim=c(3,3),
dimnames=list('Radio Format Preference'=c('Music','News-talk','Sports'), 'Age'=c('Young Adult','Middle…

JoeBe
- 1,224
- 3
- 13
- 28
0
votes
0 answers
Changing tick marks on geom_mosaic plot
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 …

Marissa
- 345
- 1
- 5
- 17
0
votes
0 answers
Use of for loops for graphics in R
I've got a table with different Plot Types and the Cluster number they are sorted by. The table looks like this:
'data.frame': 80 obs. of 16 variables:
$ GS_CT_HC_NO: Factor w/ 16 levels "GS_CT_HC_NO",..: 1 1 1 1 1 2 2 2 2 2 ...
$ CT_HC_NO :…

Sven H.
- 1
- 1
0
votes
1 answer
"set_varnames=..." in vcd mosaic plots - how to raise numbers in the labels?
I am looking for a solution on how to raise numbers in the labels of my vcd mosaic plot.
edit:
as an example i randomly selected the Sex label in the Titanic dataset:
vnames <- list(set_varnames=c(Sex="Sex=10^X"))
mosaic(Titanic,…

Alex LP
- 1
- 2