I have several thousand records. In these records, there are three fields of interest:

  1. Location - 20 possible choices
  2. Race - 5 possible choices
  3. Purchase type - 3 possible choices

I want to show the count of the possible combinations for each location on a single graphic. For example, Location 1 will have 15 possible choices (three purchase types for each of the five race choices) and the first choice might be a count of 23 observations for (1) Citytown (2) Black (3) New Purchase. The next data point could be 14 observations of (1) Citytown (2) Black (3) Rehabbed Purchase. And so on and so forth.

I realize this is 300 points to put on a graphic which may be asking a lot.

How can I put all of this information on a single graphic?


I think I'd go with something like below, where we have 20 heatmaps, one per each location, for Race x Purchase type, where the intensity of the color is related to the counts.

enter image description here

| cite | improve this answer | |
  • $\begingroup$ Do percentages work well for heatmaps? I ask because Location X has 3,000 observations but Location Y has 50. The median and averages are ~250 and ~625, respectively. $\endgroup$ – adin Sep 19 '18 at 14:24
  • $\begingroup$ @adin any values work, I created the above plot using normally distributed values. $\endgroup$ – Tim Sep 19 '18 at 14:30

What makes it more difficult to me is having 3 dimensions, not 300 buckets of combinations. If you can split it into 3 or 5 charts (combining location with race or purchase, and then facetting across the omitted one), you could do this with r's ggplot2 package to make a tile chart. Here's a link to a good example. This does not have the facetting, but there are ample example of how to add facetting with the facet_wrap function.

If you must have it in one then you could concatenate your race and purchase type categories and make that dimension have a total of 15 combinations.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.