DATA MINING
Desktop Survival Guide by Graham Williams |
|||||
Fluctuation Plot |
A variation of a mosaic plot is the fluctuation plot. A fluctuation plot visualises two variable tabular data. They provide a better presentation than heatmaps.
> library(ggplot2) > set.seed(42) > diamonds[sample(nrow(diamonds), 20), 2:3] |
cut color 49345 Very Good H 50545 Premium H 15434 Ideal F 44792 Ideal E 34614 Ideal E 27998 Premium E 39728 Very Good G 7263 Very Good J 35433 Ideal E 38025 Very Good E 24687 Good I 38782 Premium H 50406 Premium E 13775 Good F 24930 Ideal G 50691 Premium F 52750 Premium F 6336 Premium J 25613 Premium E 30214 Premium E |
> table(diamonds$cut,diamonds$color) |
D E F G H I J Fair 163 224 312 314 303 175 119 Good 662 933 909 871 702 522 307 Very Good 1513 2400 2164 2299 1824 1204 678 Premium 1603 2337 2331 2924 2360 1428 808 Ideal 2834 3903 3826 4884 3115 2093 896 |
> print(ggfluctuation(table(diamonds$cut,diamonds$color))) |