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
2
votes
1 answer
How to increase the size of a Matplotlib plot?
I made a mosaic plot with Matplotlib, but due to huge number of data points the plot is squeezed,the words overlap with each other. I want to increase the size of the plot. I tried:
plt.figure(figsize=())
It didn't work.
Here's my code:
from…

Debbie
- 911
- 3
- 20
- 45
2
votes
3 answers
Creating mosaic plot in R
I have tried many things but cannot make the mosaic plot work.
I start with a data frame:
df = data.frame(effect = c("no","no", "yes", "yes"),
sex = c("f","m","f","m"),
n = c(8,3,8,12))
df$effect <- factor((df$effect),…

user7395965
- 397
- 5
- 17
2
votes
1 answer
How to tell mosaic (mosaic plot, R, VCD package) to always print the p value even when using residual shading?
When I make a mosaic plot with default shading shade=T the p-value displays under the legend
mosaic(~ gear + carb, data = mtcars, shade=T)
When I instead use Friendly2 shading, I don't get the p-value.
mosaic(~ gear + carb, data = mtcars,…

abalter
- 9,663
- 17
- 90
- 145
2
votes
0 answers
Add text to R mosaicplot
I am trying to add text to individual tiles within a mosaicplot built using the base R function. However, I cant determine the coordinates of each center tile.
And no, I need to limit it to the mosaicplot function and don't want to use the vcd…

pmanDS
- 193
- 1
- 2
- 10
2
votes
1 answer
mosaic chart coloring, scaling and order
I am very new to R and just did my first chart:
View Plot
Could you help me understand how I can change the order of the x axis and apply coloring to the different pieces of the mosaic chart?
I would also like to reduce the spacing between the…

metalray
- 41
- 4
2
votes
1 answer
Mosaic plot (vcd package) - position of legend
I'm trying to make a mosaic plot with the vcd package, and i'm having an hard time understanding how to configure some settings of the plot.
library(vcd)
library(RColorBrewer)
mydf <-…

zelite
- 1,478
- 16
- 37
1
vote
1 answer
Is there an R Function to add a scale/ axis to a mosaic plot
Im trying to make a mosaic plot and it currently looks like this. It does not have an axis for some reason even though I have data and added the variables already. I was wondering if someone knew how to do this? Thanks
assignment$pet <-…

goodgame
- 11
- 2
1
vote
2 answers
Mosaic plot for a single variable in R like a puzzle not just vertical bars
How can I obtain something similar to a mosaic plot but representing just the information from a frequency table for a single variable?
mosaicplot(table(my_var)) works fine, but only shows vertical bars.
Is it possible to obtain a mosaic plot like a…

user2606645
- 21
- 3
1
vote
1 answer
remove duplicate labels in geom_text()
my dataset is something like:
structure(list(title = c("Fried Anchovies with Sage", "Anchovies Appetizer With Breadcrumbs & Scallions",
"Carrots, Cauliflower And Anchovies", "Bap Story: Stir Fried Anchovies (Myulchi Bokkeum)",
"Fried Anchovies"),…

Hamed_Gholami
- 153
- 7
1
vote
1 answer
how to draw a percent stacked bar plot from two distinct binary-valued columns in ggplot2?
I have two binary-valued columns in foods dataframe as follows:
foods$veryHealthy:
"False" "False" "True" "True" "False" "False" "False" "True" "False" "False" "True" "False"
"True" "False" "False" "True" "False" "True" "False" "False"…

Hamed_Gholami
- 153
- 7
1
vote
1 answer
Is it possible to change the fontsize of barplot tick mark labels with pairs_barplot in R package vcd?
With a large number of variables, the sizing of tick mark labels is too large in barplots along the diagonal of a mosaic pairs plot created with pairs_barplot() in the R vcd package. Is there any way to make them smaller? Here is a minimal working…

jtr13
- 1,225
- 11
- 25
1
vote
1 answer
How can I create a mosaic plot as shown in pic below
I have been trying for days to create a mosaic plot using land cover data but I was not able to figure it out, I am using this data :
enter image description here
I would like to create something like this:
Thanks in advance!
Zack

Zack
- 11
- 2
1
vote
1 answer
How to adjust color and text in a statsmodels mosaic plot?
I got the following code from the last plot in the Mosaic doc page:
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.graphics.mosaicplot import mosaic
gender = ['male', 'male', 'male', 'female', 'female', 'female']
pet = ['cat',…

Chuks
- 15
- 4
1
vote
1 answer
Mosaic Plot Help in R
My current plot:
My desired plot (nevermind the variables s)
Specifically: explanatory variables on the bottom with an x-axis, response variables on the right, relative frequency and the y-axis on the left. I'll attach my R code below.
mosaictable…

Tyler Brent de Leon
- 29
- 5
1
vote
1 answer
How to Successfully Produce Mosaic Plots in Pyviz Panel Apps?
I have created the following dataframe df:
Setup:
import pandas as pd
import numpy as np
import random
import copy
import feather
import matplotlib.pyplot as plt
from statsmodels.graphics.mosaicplot import mosaic
import plotly.graph_objects as…

mmTmmR
- 573
- 2
- 8
- 20