I have a
.csv table containing both categorical and numeric data.
- The first column contains the categories, which are expressed as strings.
- The second column contains the number of observations that fall in each category. This is the only numeric data in the table.
- The remaining columns contain the various occurrences of each observation, and these occurrences are strings.
To have a visual glimpse on the structure of the file:
CATEGORIES NOBS OCCURRENCE1 OCCURRENCE2 OCCURRENCE3 Street 3 Street A Street XXXXX Street YY Square 2 Square ZZZZ Square B '' Lane 1 Lane XXXXX '' '' Park 1 Park A '' ''
Notice that some strings may well be empty. Moreover, the length of the strings is variable.
Starting from this data, I would like to obtain a figure like the one below.
Ideally, I would be interested in having the overall length of each row be coherent with NOBS. This might require to reduce font size in some rows, and I am ready to do this by hand if needed. However the width of the various boxes must be determined so as to generate an overall size of the bar that is coherent with NOBS. An alternative could also be to use a fixed text box size of width equal to the longest string: the overall length of each bar would then be coherent with NOBS by construction.
I have tried to do some research on how to implement this type of figure, but I have so far failed miserably. Have I entirely missed some package or other useful solution? Any help would be greatly appreciated.