我是R的新手,但對(duì)matlab有一些經(jīng)驗(yàn)。我試圖在一張按動(dòng)物模型基因型劃分的圖上繪制三種不同面積測量值之間的比較圖。我想按基因型繪制Glom.Area、Glom.Tuft和Mesangial.Area的分面圖(對(duì)照v Cre-)。
到目前為止我的代碼:
# Setup
library(tidyverse)
library(ggbeeswarm)
library(readxl)
# work space
setwd("C:/Users/k_nic/OneDrive/Desktop")
# Read in csv file
t1 <- read.csv("sample.csv", header = TRUE)
# plot for one varible
ggplot(t1, aes(x = Genotype, y= Glom.Area))
Dataset:
Genotype Sex Glom.Area Glom.Tuft Mesangial.Area
1 Control M 6617.669 3804.877 1917.310
2 Control M 7986.696 5377.977 2761.949
3 Control M 8617.410 4443.345 2335.244
4 Control M 7785.355 4307.021 2381.512
5 Control M 9159.720 5568.449 3163.232
6 Control M 8484.327 5314.041 3238.861
7 Control M 10315.521 6105.294 3429.906
8 Control M 5517.161 3090.970 1878.288
9 Cre- M 6075.166 3438.421 2147.758
10 Cre- M 8947.698 5809.953 3744.117
11 Cre- M 6677.471 4315.344 2113.502
12 Cre- M 7616.932 4293.291 2763.791
13 Cre- M 8191.464 4778.529 2159.007
14 Cre- M 8549.339 6043.961 2922.295
15 Cre- M 11057.196 6546.740 3771.891
16 Cre- M 5911.768 3382.556 1754.674
這就是我希望它看起來的樣子:
非常感謝您的幫助!
在這種方法中,我們將三個(gè)測量值轉(zhuǎn)換為long-form數(shù)據(jù)。我們將測量名稱映射到x-axis及其沿y的相應(yīng)值。將基因型映射到填充美學(xué)產(chǎn)生成對(duì)的列。
創(chuàng)建于2023-06-1 5,代表為v2.0. 2