RhoInc / web-codebook

A web-based version of the codebook, which generates a concise summary of every variable in a dataset.
https://rhoinc.github.io/web-codebook/test-page/default/
MIT License
11 stars 5 forks source link

X-axis labels for character variables #279

Closed sjlussier closed 6 years ago

sjlussier commented 6 years ago

It seems that for character variables with very few unique values, the values are displayed to the right of the graphic in a horizontal bar chart. However, when there are more unique values, the chart becomes vertical (which is nice!), but there are no labels for the x-axis. This may be better than only having the pop-up description.

As an example see the following dataset's "site" variable:

dat <- tibble(a = rep('01', 100),
              b = sample(c('02', '03', '07', '09'), 100, replace = T),
              c = sample(1000:9999, 100, replace = T)) %>%
  mutate(id = glue("{a}-{b}-{c}"),
         site = sample(c("bost", "nyc", "phil", "chic", "la", "sd", "sf"), 100, replace = T)) %>%
  select(id, site)

image

jwildfire commented 6 years ago

Labels are tricky since they will start to overlap once N is large enough. Instead, we've set it up so the user can actually specify the point when a chart flips from horizontal to vertical bars using this setting. Default is 5 (which is maybe a little low), but one could definitely bump that up a bit if there are variables where you want the labels shown.