mosaic-plot

How to plot a mosaicplot for a 1x1 contingency table?

人走茶凉 提交于 2020-06-16 03:35:21
问题 Plotting a 1-by-1 contingency table returns an error: dat <- read.table(textConnection(' foo bar TRUE TRUE TRUE TRUE '), header = TRUE, colClasses=c('logical', 'logical')) mosaicplot(table(dat)) Error in rep.int(0, ydim) : invalid 'times' value As I learned, the code in the mosaicplot function doesn't allow to plot a 1-by-1-table. But then, how do I plot a mosaicplot of that table? Background. I am plotting a series of dynamically created tables, some of which sometimes happen to have only

How to plot a mosaicplot for a 1x1 contingency table?

∥☆過路亽.° 提交于 2020-06-16 03:35:20
问题 Plotting a 1-by-1 contingency table returns an error: dat <- read.table(textConnection(' foo bar TRUE TRUE TRUE TRUE '), header = TRUE, colClasses=c('logical', 'logical')) mosaicplot(table(dat)) Error in rep.int(0, ydim) : invalid 'times' value As I learned, the code in the mosaicplot function doesn't allow to plot a 1-by-1-table. But then, how do I plot a mosaicplot of that table? Background. I am plotting a series of dynamically created tables, some of which sometimes happen to have only

Statsmodels mosaic plot ValueError: cannot convert float NaN to integer

被刻印的时光 ゝ 提交于 2019-12-21 05:12:04
问题 I have a simple pandas DataFrame, for which I would like to create a mosaic plot. Here is my code: import pandas as pd from statsmodels.graphics.mosaicplot import mosaic mydata = pd.DataFrame({'id2': {64: 'Angelica', 65: 'DXW_UID', 66: 'casuid01', 67: 'casuid01', 68: 'EC93_uid', 69: 'EC93_uid', 70: 'EC93_uid', 60: 'DXW_UID', 61: 'AtmosFox', 62: 'DXW_UID', 63: 'DXW_UID'}, 'id1': {64: 'TGP', 65: 'Retention01', 66: 'default', 67: 'default', 68: 'Musa_EC_9_3', 69: 'Musa_EC_9_3', 70: 'Musa_EC_9_3'

Changing tick marks on geom_mosaic plot

我是研究僧i 提交于 2019-12-13 03:39:25
问题 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

ggmosaic error message: default method not implemented for type 'list'

柔情痞子 提交于 2019-12-12 06:00:23
问题 Trying to create a heatmap using ggmosaic , I keep getting the error Error in is.finite(x) : default method not implemented for type 'list' Searching for that error message, one answer was that "This error is because the is.infinite() and the is.finite() functions are not implemented with a method for data.frames." But not a useful solution in the question nor about ggmosaic Even the example from the vignette fails for me. ggplot(data = NHANES) + geom_mosaic(aes(weight = Weight, x = product

Is it possible to edit the axes labels for a mosaic plot from the vcd package?

落爺英雄遲暮 提交于 2019-12-10 15:55:59
问题 data("HairEyeColor") mosaic(HairEyeColor, shade = TRUE) Are there arguments I can use to change the labels on the margins of the resulting plot above? For instance, I'd like to change "Male" to "M", "Female" to "F", to avoid text encroachment, and make some notes in the title labels. I can't find anything about editing axis labels in the package's help page. 回答1: lnames <- list(Sex = c("M", "F")) mosaic(HairEyeColor, set_labels=lnames, shade=T) Or... mosaic(HairEyeColor, set_labels=list(Sex =

R vcd::mosaic overlapping labels

一世执手 提交于 2019-12-08 02:06:03
问题 I'm generating a mosaic plot with vcd::mosaic . But the text of the factors I was given are very long (cutting them is not an option, and with so many instances, introducing \n seems daunting), so there's an overlap in the texts, and I haven't been able to force the labels to go perpendicular to the axis. This is what I'm trying: a <- data.frame(x=sample(LETTERS[1:4],16,replace = TRUE), y=rep(paste("very long label here at number", 1:4, paste=" "), 4)) mosaic(y ~ x, data= a, las= 2) but this