mosaic-plot

R vcd::mosaic overlapping labels

大憨熊 提交于 2019-12-06 07:25:10
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 is what I get: I've also tryed par(las= 2) and par(las= 3) but none of those is able to force them into

Statsmodels mosaic plot ValueError: cannot convert float NaN to integer

寵の児 提交于 2019-12-03 16:00:39
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', 60: 'default', 61: 'default', 62: 'default', 63: 'default'}}) mydata id1 id2 60 default DXW_UID 61