r - Visualization of risk table with 4 dimensions -


i have data set consisting of customers, distributed distinct , complete countries , customer levels. each country/level combination has size , risk attribute. risk attribute indicates how big problem is, size attribute how large associated population is.

example data (r): http://www.r-fiddle.org/#/fiddle?id=kvmctmz8&version=12

how visualize data in order show 4 dimensions (conceptually, not coding-wise)?

my initial idea create 2-dimensional table/lattice (country x level), size bubbles , risk color scale, i'm worried effectiveness of bubble plots.

edit: code link correction

i keep answer separate should data - depends on trends within data , message trying convey.

using ggplot2, ways can summarize data geom_point object captured aes() argument. these are:

  • x
  • y
  • alpha
  • colour
  • fill
  • shape
  • size
  • stroke

this gives potential 8 dimensions can graph data on. few of these, color , fill, can use in combination right shape (pch = 21 - 25, see here). well, shape cannot mapped continuous variable, limited there well.

that said, never suggest using of them @ once, graph become hard interpret, theoretically could.

sample code

ggplot(df, aes(x = size, y = risk)) + geom_point(aes(color = country, size = custlevel)) 

enter image description here

for discrete variables, second lever pull facets. can add (theoretically, not recommended) infinite dimensions data, depending on how many subsections need. example:

ggplot(df, aes(x = size, y = risk)) + geom_point(aes(color = country)) +  facet_wrap(~custlevel) 

enter image description here

you can use facet_wrap or facet_grid, adding additional dimensions within argument (i.e. facet_wrap(~custlevel + country) or facet_wrap(~custlevel + country + size)

again, not recommended decrease readability. however, these tools @ disposal.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -