我是R的新手,想在R中创建一个填充的等高线图,以显示水柱(y)随时间(x)的氧浓度(z)变化。 Bellow是我使用filled.contour()函数制作初始图的方法。我的问题是: 1-如何更改绘图的颜色?我喜欢它介于深蓝色(高氧气)和红色(低氧气)之间 2-由于Y轴上出现深度,如何从22米(湖的最大深度)而不是0米开始,使图更容易理解?
谢谢你
mat <- structure(c(9.76, 11.25, 11.15, 8.56, 8.94, 6.51, 8.30, 9.16,
6.75, 6.16, 6.48, 7.18, 7.17, 5.34, 5.03, 9.78, 11.52, 11.22, 7.39,
8.97, 6.48, 8.28, 9.40, 6.69, 6.11, 6.34, 7.06, 6.45, 5.05, 4.51, 9.72,
11.57, 11.21, 8.35, 8.96, 6.47, 8.21, 9.37, 6.60, 6.08, 6.31, 6.90,
5.86, 4.51, 3.56, 10.16, 11.53, 9.75, 8.53, 8.96, 6.44, 8.12, 9.37,
6.48, 6.04, 6.25, 6.81, 5.62, 4.19, 3.21, 10.48, 9.70, 8.78, 7.89,
9.00, 6.43, 8.08, 8.41, 6.33, 6.02, 6.22, 6.68, 5.51, 3.73, 2.88, 8.95,
8.01, 7.48, 7.42, 7.89, 6.41, 7.95, 7.80, 6.13, 5.92, 6.20, 6.52, 4.89,
3.31, 2.27, 7.41, 5.06, 4.10, 4.45, 3.25, 6.40, 7.71, 7.46, 5.97, 5.90,
6.17, 6.15, 4.31, 2.94, 1.72, 5.71, 3.86, 1.27, 1.97, 0.61, 6.38, 5.94,
7.43, 5.89, 5.87, 6.15, 5.81, 3.70, 2.70, 1.26, 5.02, 3.30, 0.80, 0.27,
0.48, 6.34, 4.89, 7.10, 5.87, 5.87, 6.12, 5.52, 3.34, 2.23, 0.58, 3.90,
3.02, 0.43, 0.18, 0.41, 5.92, 2.43, 6.97, 5.91, 5.92, 6.10, 5.01, 3.01,
0.32, 0.18, 3.46, 2.51, 0.24, 0.19, 0.38, 0.51, 0.19, 6.03, 5.92, 5.93,
6.09, 4.79, 1.86, 0.26, 0.10, 2.87, 1.35, 0.18, 0.14, 0.36, 0.23, 0.03,
5.52, 5.90, 5.97, 6.08, 4.46, 0.72, 0.20, 0.09, 1.67, 0.72, 0.12, 0.10,
0.34, 0.14, 0.00, 1.64, 5.72, 5.27, 6.06, 4.05, 0.52, 0.15, 0.07, 0.82,
0.59, 0.09, 0.08, 0.33, 0.13, 0.00, 0.41, 5.66, 5.86, 6.05, 0.90, 0.44,
0.14, 0.06, 0.48, 0.43, 0.07, 0.07, 0.32, 0.11, 0.00, 0.25, 2.47, 5.85,
6.03, 0.49, 0.39, 0.13, 0.05, 0.38, 0.37, 0.07, 0.07, 0.33, 0.10, 0.00,
0.19, 0.14, 5.62, 6.02, 0.35, 0.38, 0.12, 0.05, 0.28, 0.34, 0.07, 0.06,
0.33, 0.09, 0.00, 0.16, 0.08, 4.11, 6.02, 0.28, 0.36, 0.11, 0.04, 0.30,
0.33, 0.09, 0.07, 0.32, 0.09, 0.00, 0.15, 0.06, 0.72, 6.02, 0.24, 0.35,
0.10, 0.03, 0.31, 0.31, 0.11, 0.08, 0.31, 0.08, 0.00, 0.14, 0.04, 0.10,
6.01, 0.21, 0.34, 0.09, 0.02, 0.38, 0.31, 0.09, 0.07, 0.30, 0.08, 0.00,
0.14, 0.03, 0.06, 6.01, 0.22, 0.33, 0.07, 0.02, 0.44, 0.30, 0.07, 0.05,
0.29, 0.07, 0.00, 0.13, 0.02, 0.04, 6.01, 0.26, 0.31, 0.05, 0.02, 0.41,
0.30, 0.04, 0.04, 0.28, 0.06, 0.00, 0.14, 0.01, 0.02, 6.02, 0.27, 0.31,
0.05, 0.02, 0.37, 0.29, 0.04, 0.03, 0.28, 0.06, 0.00, 0.14, 0.00, 0.01,
6.02, 0.26, 0.31, 0.05, 0.02), .Dim = c(15L, 23L), .Dimnames =
list(c("06/25/2015", "07/08/2015","07/22/2015", "08/04/2015",
"08/18/2015", "09/01/2015", "09/15/2015", "09/30/2015","10/14/2015",
"10/26/2015", "11/12/2015", "01/06/2016", "01/20/2016", "02/04/2016",
"02/16/2016"), c("0.5", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21",
"22")))
dates <- as.Date(dimnames(mat)[[1]], "%m/%d/%Y")
depths <- as.numeric(dimnames(mat)[[2]])
filled.contour(x=dates, y=depths, z=mat, xlab="Date", ylab="Depth")