autoplot.prcomp_qts | R Documentation |
prcomp_qts
objectsThis function creates a visualization of the results of the PCA applied on a sample of QTS and returns the corresponding ggplot2::ggplot object which enable further customization of the plot.
## S3 method for class 'prcomp_qts'
autoplot(object, what = "PC1", ...)
object |
An object of class |
what |
A string specifying what kind of visualization the user wants to
perform. Choices are words starting with |
... |
If |
A ggplot2::ggplot object.
df <- as_qts_sample(vespa64$igp[1:16])
res_pca <- prcomp(df)
# Plot the data points in a PC plane
# And color points according to a categorical variable
p <- ggplot2::autoplot(res_pca, what = "scores")
p + ggplot2::geom_point(ggplot2::aes(color = vespa64$V[1:16]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.