[英]R ggplot2 geom_point shapes
我正在使用ggplot2
並希望我的geom_points
具有基於 dataframe 行的單獨形狀。
data <- read.csv(my_csv_path) #
plot <- ggplot(data = data) + # in this file I have shape numbers (17 or 21) for each csv row.
geom_point(aes(shape = shape), color = "grey20")
每行都有單獨的形狀,我想根據它來繪制。 我的 output 總是根據 csv 文件繪制三角形。
有任何想法嗎?
謝謝 !
希望這將適用於您的數據。 如果沒有,請使用dput
粘貼數據樣本。 scale_shape_identity
應用來自 dataframe 的形狀編號:
library(ggplot2)
library(dplyr)
tibble(shape = 1:5, x = 1:5, y = 1) %>%
ggplot(aes(x, y, shape = shape)) +
geom_point(size = 10, colour = "grey20") +
scale_shape_identity()
由代表 package (v0.3.0) 於 2020 年 12 月 15 日創建
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.