Tôi đang vẽ một ma trận phân tán bằng cách sử dụng ggpairs
. Tôi đang sử dụng đoạn mã sau:Cách thêm chú giải bên ngoài vào ggpairs()?
# Load required packages
require(GGally)
# Load datasets
data(state)
df <- data.frame(state.x77,
State = state.name,
Abbrev = state.abb,
Region = state.region,
Division = state.division
)
# Create scatterplot matrix
p <- ggpairs(df,
# Columns to include in the matrix
columns = c(3,5,6,7),
# What to include above diagonal
# list(continuous = "points") to mirror
# "blank" to turn off
upper = "blank",
legends=T,
# What to include below diagonal
lower = list(continuous = "points"),
# What to include in the diagonal
diag = list(continuous = "density"),
# How to label inner plots
# internal, none, show
axisLabels = "none",
# Other aes() parameters
colour = "Region",
title = "State Scatterplot Matrix"
)
# Show the plot
print(p)
và tôi nhận được cốt truyện sau:
Bây giờ, người ta có thể dễ dàng nhận thấy rằng tôi nhận được huyền thoại cho tất cả các âm mưu trong ma trận. Tôi muốn có một huyền thoại phổ quát cho toàn bộ cốt truyện. Làm thế nào để làm điều đó? Bất kỳ trợ giúp nào cũng sẽ được đánh giá cao.
Tại sao điều này được dán nhãn 'shiny' ??? – jlhoward
Đã xóa thẻ, cảm ơn bạn đã chỉ thẻ. – Patthebug