Module # 9 assignment
CODE
# Load necessary library
library(ggplot2)
# Create scatterplot matrix
scatterplot_matrix <- ggplot(CigarettesB, aes(x = price, y = packs, color = income)) +
geom_point() +
labs(title = "Scatterplot Matrix of Cigarette Data",
x = "Price",
y = "Packs",
color = "Income") +
theme_minimal()
# Print the scatterplot matrix
print(scatterplot_matrix)
Judgment on Multi-Variable Visualization:
Multivariate visualization is a powerful way to explore relationships between multiple variables simultaneously. In the context of the cigarette data, a scatterplot matrix allows us to visualize the relationships between the price of cigarettes, the number of packs sold, and the income associated with each observation. This type of visualization enables us to identify patterns, clusters, and trends that may not be apparent when examining variables individually. By visualizing multiple variables at once, we gain a more holistic understanding of the underlying data structure and potential correlations between variables.
Comments
Post a Comment