【发布时间】:2020-08-25 15:10:31
【问题描述】:
我有两个数据集(我最终将使用八个),我将它们组合起来创建了一个散点图。问题是,现在我已经绘制了散点图,我不知道如何分离我组合的数据,因此颜色代表各个数据集。这是我的代码...
#Here is what I've combined:
t<-rbind(test202, test342)
#Here is plotting the scatter-plot
```{r}
g<-ggplot(t,aes(x=percentage,y=as.numeric(area), col = area, group = area ))+
geom_point()+
labs(x=expression(paste("Percentage (%)")),
y=expression(paste("Area (m"^2,")"))
)+
scale_y_continuous(breaks = seq(0, 20, by = 1)) +
theme_bw() +
theme(element_blank())
g
``
我试过用谷歌搜索,但似乎找不到任何特定的代码来解决这个问题。我附上了一张最终产品和't's内容的图片。 contents of 't'scatter-plot of 't'
编辑:输入(t)
t <- structure(list(percentage = structure(c(1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L), .Label = c("30", "35",
"40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90",
"95"), class = "factor"), area = c(1.0068507612755, 1.28144642344154,
1.55604208560758, 1.92216963516231, 2.28829718471704, 2.65442473427176,
3.20361605860385, 3.75280738293594, 4.39353059465671, 5.30884946854352,
6.49876400459638, 7.96327420281528, 10.068507612755, 13.6382512209135,
1.12935650675177, 1.4004020683722, 1.67144762999262, 1.98766745188312,
2.34906153404369, 2.75562987647432, 3.16219821890496, 3.65911508187574,
4.15603194484652, 4.74329732835744, 5.37573697213844, 6.18887365699971,
7.22788164321134, 8.89932927320397)), row.names = c(NA, -28L), class = "data.frame")
【问题讨论】:
-
t在哪里?重现您的问题需要数据! -
我附上了照片,如果你能看到?你是这个意思吗?谢谢
-
您能否在控制台中执行此操作:
dput(t)并将输出粘贴到问题中? -
是的,我会这样做,谢谢