我有以下数据。
x_plus <- c(1.3660254, 1.1123724, 1.0000000, 0.9330127, 0.8872983,
0.8535534, 0.8273268, 0.8061862, 0.7886751, 0.7738613,
0.6936492, 0.6581139, 0.6369306, 0.6224745, 0.6118034,
0.5968246, 0.5866025, 0.5707107, 0.5612372, 0.5500000,
0.5433013, 0.5387298, 0.5353553, 0.5306186, 0.5273861,
0.5193649, 0.5158114, 0.5122474, 0.5103510, 0.5086603,
0.5050000, 0.5027386, 0.5008660)
x_minus <- c(-0.3660254, -0.1123724, 0.0000000, 0.0669873, 0.1127017,
0.1464466, 0.1726732, 0.1938138, 0.2113249, 0.2261387,
0.3063508, 0.3418861, 0.3630694, 0.3775255, 0.3881966,
0.4031754, 0.4133975, 0.4292893, 0.4387628, 0.4500000,
0.4566987, 0.4612702, 0.4646447, 0.4693814, 0.4726139,
0.4806351, 0.4841886, 0.4877526, 0.4896490, 0.4913397,
0.4950000, 0.4972614, 0.4991340)
y <- c(1.50, 3.00, 4.50, 6.00, 7.50, 9.00, 1.05e+01, …Run Code Online (Sandbox Code Playgroud) 我有以下向量作为示例。
isotopes <- c("6Li", "7Li", "7LiH", "10B", "11B", "11BH")
Run Code Online (Sandbox Code Playgroud)
我想从向量中删除字符串"7LiH"和。"11BH"这些值有两个大写字母,因此我试图弄清楚如何使用grep删除这些值或仅索引向量中的其他字符串。我怎样才能做到这一点?
我正在尝试将灰度色带添加到变量 z 的 ggplot 中的连续色标中。下面是一个示例,但我无法弄清楚如何制作连续的灰度。
library(ggplot2)
x <- seq(0,10,1)
y <- seq(11,20,1)
z <- seq(21,30,1)
df <- data.frame(cbind(x,y,z))
ggplot(df,aes(x,y))+
geom_point(aes(color = z), size = 3)+
scale_color_continuous(type = "viridis")
Run Code Online (Sandbox Code Playgroud)