- Strategies for Multidimensional data visualization:
- direct visualization (this was approached last class)
- projections (dimensionality reduction)
- Principal Components Analysis (PCA) visualization
November 15 2022
Examples of linear projection methods:
Example of nonlinear projection methods:
We will be using the Nutrition Facts for McDonald’s Menu dataset which contains a number of different variables/features for each menu item.
You can check the complete data set
The variance explained by principal component is also available.
There’s also a data set with the principal component loadings
And here’s the principal components per observation data set
Build a scatter plot mapping PC1 to x, PC2 to y, and category to fill.
Check the rule mark documentation for Vega.
Add rule marks for the loadings
data (you have to add scales as well) mapping x and y to zero, x2 to PC1, and y2 to PC2.
How can you replicate the plot you created to show PC3 vs. PC4, and PC5 vs. PC6?
Vega-lite is a higher-level language built on top of Vega that automates some constructions and makes the JSON specification significantly shorter.
Vega-Lite allows the creation of common plots fast.
“Compared to Vega, Vega-Lite provides a more concise and convenient form to author common visualizations. As Vega-Lite can compile its specifications to Vega specifications, users may use Vega-Lite as the primary visualization tool and, if needed, transition to use the lower-level Vega for advanced use cases.”
Here are two examples on how to use Vega-Lite with the data we’ve been working with, the McDonald’s menu data: