5
Bir değişken (burada "vektör elemanı" tipi ") ve n eksen etiketinin içinde bir üst simge (burada m^2) içeren bir birimi birlikte kullanmak istiyorum.Eşzamanlı olarak üst simge ve değişken bir eksen etiketinde ggplot2 ile nasıl kullanılır
data <- list(houses = data.frame(surface = c(450, 320, 280),
price = c(12, 14, 6)),
flats = data.frame(surface = c(45, 89, 63),
price = c(4, 6, 9)))
ben etikette değişken eklemeye çalıştığınızda "m^2" bir ifade kullanarak,
for (type in c('houses', 'flats')){
p <- ggplot(aes(x = surface, y = price), data = data[[type]]) +
geom_point() +
xlab(expression(paste('surface of this type /', m^{2})))
}
p
ama, şu, tabii ki, çalışmıyor gösterilecek ulaşmak:
for (type in c('houses', 'flats')){
p <- ggplot(aes(x = surface, y = price), data = data[[type]]) +
geom_point() +
xlab(expression(paste('surface of ', type, '/', m^{2})))
}
p
Bir öneriniz var mı?