我有一个数据集包含 0 - 140 的深度数据,其他列包含一些百分比。我使用 ggplot 和 facet 绘制数据,除了轴底部 y 轴(深度)上的零之外,它很棒。我希望这个零位于 y 轴的顶部。
这是数据,例如:
log <- structure(list(
Depth = c(5,10,15,20,25,30,35,40,45,50,55, 60,65, 70,75,80, 85,90, 95,100,105,110,
115,120,125,130,135,140),
mic1 = c(16.93548387,13.55932203, 6.034482759,33.6, 26.8907563, 51.47928994,
24.29906542,16.84210526, 26.14379085, 19.72318339,21.77419355,
53.33333333,50.56179775,19.07514451,27.63819095, 25.6, 23.56687898,
19.04761905, 43.33333333,36.30952381,62.45059289,20.43010753,
32.23140496,16.4021164,47.48201439,48.73646209,17.44186047,
39.04109589),
mic2 = c(16.93548387, 13.55932203, 6.034482759,33.6, 26.8907563, 51.47928994,
24.29906542,16.84210526, 26.14379085, 19.72318339,21.77419355,
53.33333333,50.56179775,19.07514451,27.63819095, 25.6, 23.56687898,
19.04761905, 43.33333333,36.30952381,62.45059289,20.43010753,
32.23140496,16.4021164,47.48201439,48.73646209,17.44186047,
39.04109589)),
.Names = c("Depth", "f1", "f2"), row.names = c(NA, 20L), class = "data.frame")
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码将它们绘制在条形图中:
logMelt1 <- melt(log, id.vars="Depth")
logm <- ggplot(logMelt1, aes(x=Depth, y=value)) …Run Code Online (Sandbox Code Playgroud) 我在 R 中使用 ggplot 或 boxplot 函数绘制箱线图有问题。我在这里解决了一些问题,但没有一个能解决我的问题。
我的数据集包含 20 个样本,每个样本有 10 个元素。我正在尝试生成箱线图,所以这就是我到目前为止所做的:
NC_RSD.ca.m <- melt(NC_RSD.ca, id.var="Sample")
Run Code Online (Sandbox Code Playgroud)
这是示例数据:
structure(list(Sample = structure(c(15L, 16L, 17L, 18L, 19L,
20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L), .Label = c("NC10", "NC11", "NC12", "NC13", "NC14", "NC15",
"NC16", "NC17", "NC18", "NC19", "NC20", "NC21", "NC22", "NC23",
"NC4", "NC5", "NC6", "NC7", "NC8", "NC9"), class = "factor"),
Al = c(21.54055979, 13.89504614, 20.19173286, 15.39846212,
18.6210721, 19.3885953, 17.29371421, 13.85368756, 15.59018781,
14.81984326, 41.64842461, 16.29394917, 14.7150582, …Run Code Online (Sandbox Code Playgroud)