0

好吧,我想,这是一个挑战!我在这上面花了几个小时,想在遇到路障时最后一次尝试。

我正在绘制一个看起来像这样的集群图(我刚刚意识到我无法发布图像。所以,这是我正在使用的数据框和命令)。

再现性数据框:

structure(list(PC1 = c(2.2256, 1.4809, -0.26, 2.2323, -2.9459, 
-0.8887, -4.4638, -2.4257, -0.0317, 2.6486, 0.152, -1.2285, -0.1575, 
0.2191, -2.739, -2.1619, -3.0452, -0.5263, -2.6021, 2.4344, -3.3099, 
-1.6198, -1.5211, 1.8298, 0.3087, -1.5687, -4.6785, -0.3389, 
-0.1651, -0.6272, -1.705, -1.5658, -2.1851, 9.689, -2.1915, 0.2614, 
-2.7237, -3.2731, 3.4681, 0.3675, 3.5045, 10.9197, -1.1395, -0.4404, 
1.2303, -0.4029, 1.0831, 1.3574, 0.7774, -0.0421, -2.6289, 1.2752, 
4.6786, -3.3749, -1.7164, 0.8981, -4.7529, -0.4039, -1.8553, 
1.1387, -1.648, 1.2547, -1.1931, -0.926, -0.8275, -0.4611, 0.553, 
-3.5188, -0.7385, -3.5622, 1.8351, -1.5409, 0.6458, 2.8193, -1.0229, 
1.3415, 2.1953, -1.0201, -0.3953, -0.69, 0.0324, -2.6105, -2.5362, 
2.9971, -0.3935, -0.1593, -1.0181, -1.7703, 2.5865, 0.2388, -2.5744, 
-0.977, 0.8738, -1.282, -0.3212, -4.5051, 2.5541, 0.939, 0.2235, 
-4.0283, -0.6163, -0.7022, 3.1862, -4.1619, 0.14, -1.7597, 3.1879, 
0.9497, -0.4271, -0.7919, -0.0288, -3.8525, -3.9967, 2.075, 1.7007, 
11.1462, 2.7227, -1.8918, -2.3526, 11.5197, -0.2416, 2.8507, 
0.4484, -1.4711, 1.9363, 1.305, 0.7839, -0.8864, -3.0569, -3.0861, 
-0.3328, -0.8241, -1.4074, -2.6751, -2.6399, 1.9194, -2.13, -3.7832, 
9.6771, 0.2056, -0.0926, 0.0071, -2.5723, 1.2282, -2.7776, -4.6016, 
-2.5425, 10.4316, 0.6533, -5.0102, -2.3975, -0.9215, -4.8145, 
-1.9591, -0.9514, -0.3105, 0.9918, -0.6624, 2.1525, -2.8638, 
-0.9873, -1.029, -0.1707, 1.7098, -5.6037, -0.5896, 6.268, -3.1572, 
-3.2034, -4.0433, 0.38, 3.583, 0.3973, -0.0873, 4.9091, 1.5223, 
-1.4587, 1.5949, -4.7834, -1.5867, -1.6688, -0.5916, 2.0728, 
-2.1145, 10.652, -3.217, -0.2973, -3.4136, -4.3339, 3.4852, -1.3428, 
0.8035, -1.2665, -1.5503, 5.8025, 0.7781, -0.4766, -5.579, -4.3625, 
1.4434, -2.1981, 1.3691, 3.2523, -4.7446, -1.1033, 1.5775, 2.8077, 
-3.7935, -0.9483, -1.0598, -2.2209, -1.419, -1.9619, 0.5149, 
-3.3048, -0.3856, -2.3847, -0.938, 2.7408, -1.9428, -0.9983, 
-2.3646, 1.8657, -0.9576, -2.9655, -2.8098, -4.0351, 0.1078, 
1.7308, 0.9215, -2.9707, 2.2219, 7.8006, -2.1898, -1.0951, -0.5461, 
-5.4806, 0.0708, -2.3331, -0.088, -2.3114, 1.1267, -0.9264, 0.9225, 
0.0624, -4.3882, -2.5275, -2.4429, -0.9523, -3.6885, 5.1539, 
-2.6542, -3.6966, -3.3687, -5.1634, 0.5688, 0.9247, -4.6081, 
-1.8565, 2.1829, -3.16, -2.588, -0.5039, 7.6707, -0.4142, -4.345, 
-4.6737, 0.7462, 1.3465, -1.1949, 1.9076, -2.05, -3.2861, 1.2469, 
0.8937, -1.6392, -0.8577, -0.0177, -2.7009, 0.2848, 11.9307, 
3.5277, -3.1443, 0.9763, -1.8637, -0.4509, -1.4086, 0.9918, -4.1019, 
-2.6204, 2.199, -4.2807, 2.1375, 0.2313, -4.5694, -2.6465, 1.5511, 
-2.1972, -3.6588, -0.94), PC2 = c(1.062, -3.8278, -2.2686, 1.137, 
2.6166, 7.7512, -1.7719, 2.4735, -1.7442, -1.0233, -4.0604, 1.4224, 
-2.1057, -2.2437, 0.034, 0.7467, -3.9813, -2.0182, 1.3059, 0.7223, 
0.9685, 1.7667, -2.2334, -1.9834, -0.3307, -2.2389, -3.8387, 
3.0782, -4.137, 0.5813, -2.9272, -0.1671, -3.5508, -0.3841, 0.1688, 
-2.4125, -4.6203, 0.491, -0.8238, -0.9563, 0.9952, -1.5027, -3.7886, 
-4.3074, -0.9484, 4.0531, -6.0254, -2.5213, -1.5968, 0.1942, 
5.183, -4.5221, -0.4104, -2.3955, 0.1762, -0.037, 1.213, -2.7664, 
0.3025, -2.1785, 1.7589, -2.7747, 1.8594, -1.8585, 0.1826, -0.4348, 
-3.7679, 2.4107, -9e-04, 0.102, -2.2939, 3.758, -0.7306, 0.1016, 
-2.625, -0.7092, 0.5654, 0.869, -2.5551, -5.5576, 0.0563, 1.0645, 
-1.5076, -0.0124, -3.7385, 3.5632, 0.6315, 3.6795, -2.5951, -0.506, 
1.5813, 0.4424, -6.1987, 1.9711, -0.1391, -0.7236, -1.6882, -1.6159, 
1.616, -1.0355, 3.7336, -2.4115, 0.769, 2.7689, -2.218, 1.9332, 
-1.5474, -2.2945, 2.8818, -3.8946, -2.2153, -2.2179, 0.1367, 
4.1974, -0.5861, -0.823, 1.724, -4.331, 0.0725, -1.1548, 7.844, 
-0.3664, -2.8116, -2.0724, -0.7442, -3.4079, 2.2524, 3.2092, 
2.0544, 2.7299, -4.7838, 2.5654, -5.5837, -4.0581, 1.0475, -0.4572, 
-2.9878, -2.641, -0.7713, -2.9609, 1.2831, -2.2095, 2.6252, 5.3245, 
0.7972, -0.6487, -0.8716, 0.5108, -0.2301, -3.9016, 0.287, 1.2736, 
1.5818, -3.9952, -2.1491, 2.5403, 1.6406, -3.0673, 1.6671, 4.4645, 
-0.2323, -1.2833, 3.1283, 1.943, -1.7386, -3.1695, 2.06, -1.4619, 
-4.7212, -4.3526, -0.878, -2.247, -1.7027, -3.1427, 4.4404, 1.4203, 
-3.1345, -2.6465, -1.7373, 2.8601, -1.1626, 3.8693, -0.8583, 
0.7912, -3.8168, -5.5851, 3.4861, -0.5579, -0.0445, 1.3809, -1.3812, 
-4.0318, 6.7811, 2.5582, 3.2445, 0.9699, -2.5507, -0.9889, 0.6898, 
-3.3987, -4.3716, 2.1602, -2.6728, -1.8145, 5.0164, 2.3748, 1.5508, 
0.7534, 1.1681, -1.6018, 0.0308, -2.135, -1.5724, -5.7036, 0.025, 
0.8324, 2.4963, 2.0653, -0.3984, -0.3348, -4.1734, 0.7979, -3.0556, 
-4.5411, 0.7944, 0.1973, -3.0621, 6.1245, -3.2084, -1.3371, -0.6685, 
-0.7438, -0.6533, -2.895, 4.3857, -2.201, 1.0328, 2.9484, -1.0609, 
-1.1653, -0.6915, -1.442, -3.1566, 1.7276, 1.1668, -3.6144, -3.3186, 
3.8696, -5.2487, 2.4558, -2.1328, -1.0334, -1.5281, -5.7793, 
-0.7524, -3.4909, 4.335, -0.3089, -0.8972, -1.0694, -0.5497, 
-1.1873, 9e-04, -3.5336, 1.6173, 2.891, -3.5485, -5.5309, 0.5986, 
0.5252, -6.6428, 0.6717, -1.7727, -0.5078, -4.8289, -0.857, -0.451, 
-0.4197, 1.0673, -2.8686, -0.376, 2.066, -1.4398, 0.6436, 2.6821, 
-3.4937, -1.3001, 1.6406, 1.712, -2.6586, 0.0102, -2.308, 0.2749, 
-1.4558, -0.5235, 1.2903, 1.2796, 4.6678, 3.2834, -3.4908), PC3 = c(1.8194, 
-2.5651, -2.4701, -1.7064, 1.1729, -0.4935, 3.3485, 1.7217, -2.7786, 
6.3311, -3.6903, 0.3025, -2.9235, -2.8914, -0.5739, 3.6833, -1.497, 
1.4005, 2.2265, 4.5632, 0.8387, 0.694, -2.3551, 1.1719, 4.6177, 
0.6201, 2.3209, -0.6963, -3.0441, 1.5237, -0.3986, 1.1555, 1.9629, 
3.4838, -0.4774, -2.7396, 0.9682, 3.7912, 2.1377, -1.8566, 0.9613, 
-0.1837, 4.214, -0.8082, 3.5541, -1.8595, -2.7905, -2.5326, -0.8995, 
-0.7312, -0.1763, -2.0726, 2.5378, 0.6211, 1.6998, 1.5665, 0.4586, 
-2.3965, 0.3287, -2.0237, -1.1516, 1.4491, 3.2198, 2.8354, 0.1725, 
1.5858, -2.8418, 2.3849, -0.0492, 2.9697, 1.5061, -1.9589, 1.1382, 
0.0703, 0.2773, 2.7847, 0.6627, -2.0828, -2.6255, -1.4492, 1.6866, 
0.2628, -2.102, -0.7487, -2.5129, -0.3193, 1.3504, -0.417, -2.5764, 
3.22, 1.5988, 1.3732, -2.7233, -1.5127, 0.1545, 1.7917, 3.2315, 
-3.2092, 1.6798, 0.5898, -1.5925, -1.7699, 5.322, 0.5261, 3.0634, 
0.3691, 2.0846, 0.9458, -0.7351, -3.2953, -3.1213, 1.0529, 0.9614, 
0.031, 1.9807, 1.0511, 2.3976, -1.5736, 1.1312, 1.2936, 0.0059, 
3.1171, -1.2461, -2.9551, 2.0226, 0.5991, -2.4565, -0.4575, 2.4161, 
5.1449, -2.9822, 0.8863, -3.825, -2.2242, 1.6873, 2.5818, -1.9726, 
0.0108, 4.4975, -1.5744, -1.7228, -3.1268, 2.2604, -1.3887, 0.0045, 
1.4843, 0.3979, 2.0207, 1.6031, -2.1704, 0.6586, 1.3145, 1.4932, 
0.3033, -1.6698, 0.2015, -1.9904, -2.2213, -0.815, 0.9555, 4.6244, 
-1.7535, -0.8152, 2.1398, 1.4181, -2.9203, 2.7319, 1.671, -1.1838, 
1.9147, 4.5097, 1.8006, -2.1203, -0.7905, 1.9587, 4.8921, -1.7787, 
1.8319, 1.4435, -2.226, 2.3515, -2.7543, 0.5666, 0.2525, 0.8702, 
-3.2293, 1.9826, 0.9395, 3.1577, 1.5882, 2.8963, -1.6802, -0.8536, 
1.6328, 0.4904, -1.023, -2.341, 2.4352, 2.7221, -2.6323, -1.9808, 
4.0606, 3.4985, 1.2773, -1.3579, 2.8691, 2.704, 4.0382, 0.928, 
-0.4525, 0.8558, -3.4121, 0.7687, -2.9728, 1.3936, 2.1161, 2.1325, 
-0.4083, 2.2895, 2.1118, -0.2269, 1.0511, -2.518, -1.6614, 1.4253, 
1.1722, 1.1326, -0.5715, 1.2108, -3.125, -0.5934, 5.1605, 2.7877, 
-2.807, -0.7033, -0.956, 1.3176, -1.8061, 2.4586, 1.323, 2.563, 
-2.9877, 0.683, -1.8166, -1.2402, 1.4299, -2.5613, 0.5736, -3.4245, 
0.0788, 0.4948, 1.0333, 0.5982, -3.0088, 2.7771, -2.0868, 0.4091, 
2.9316, 1.1828, 4.2806, 2.0805, 1.9528, -1.1379, 2.204, -0.8486, 
-1.2042, -0.5654, -2.7485, -0.9031, 0.9803, -2.1279, 0.2206, 
2.0372, -2.0573, 0.0986, 0.2512, -0.5894, -1.2828, -0.1711, -2.5129, 
0.5729, 1.5563, 1.9921, -2.5638, 1.6535, -3.1877, -1.6301, -1.9904, 
3.6299, -1.9487, -0.1593, -1.1259, -0.0364, 2.8499, 0.8245, 1.9109, 
6.6634, -0.4726, 4.0705, 0.1674), PC4 = c(-1.6809, 2.227, -0.075, 
-0.6021, 0.6097, 1.3754, -0.1437, 0.7101, -0.1795, -0.0401, 0.6585, 
-1.6154, -1.8066, -1.0366, -1.0494, -0.0897, 2.1065, 0.022, 0.3171, 
-1.1914, 0.812, 0.407, -0.4577, -0.2013, 0.3993, -1.3618, -1.3296, 
1.0466, 0.8122, -0.5493, -0.8828, -0.8294, 0.1012, -0.1122, 1.5744, 
-0.7616, 0.3152, -0.3369, -1.5726, -0.4943, -0.5911, -0.3582, 
0.1438, -2.2296, -0.6858, 0.1225, -0.7572, 0.1741, -0.7606, 2.1613, 
0.7969, 1.4509, -0.2938, 0.7183, 1.1652, 0.3502, 1.6445, -0.2476, 
-0.2286, 0.0116, 0.2442, -0.9639, 0.1028, -0.3746, -0.0617, -1.6034, 
0.6863, -0.3183, 0.7681, -0.2873, -0.7857, 1.0165, 0.1969, -0.2992, 
0.4876, -0.9068, -1.0005, -0.8244, 0.1367, -1.7777, -0.6293, 
0.6, -3.2697, -1.4074, -2.1328, 0.5042, 0.9385, 0.6153, 1.2522, 
-1.3579, 0.875, -0.3984, -1.4517, -1.1958, -0.4924, 0.7429, 1.1159, 
-0.6791, 1.2641, -0.877, 0.0022, -0.5704, 0.3748, 0.5973, -1.0422, 
1.7233, -0.7283, -2.0859, 0.8287, -4.6005, 0.5384, 0.9084, 1.188, 
-0.1872, -0.7145, 0.098, -1.0977, -0.4468, -0.3076, -0.1735, 
0.5855, 0.0253, 0.4055, -1.8864, -2.1891, 1.0356, 0.8634, -0.0115, 
0.4144, 0.2565, -2.2025, 1.408, -3.1021, -2.2058, -0.8091, -2.1892, 
-0.1375, -1.2207, -1.1782, 0.6638, -0.8493, -1.0138, -0.6362, 
0.3053, 1.0213, -0.063, -1.9581, -1.2428, 0.1985, -4.8922, 0.4737, 
0.0275, -1.7479, 0.5607, 1.2613, 1.3478, -1.6331, 0.1288, -1.2546, 
-0.8544, -0.2725, -0.0153, 0.491, 0.0808, 1.1406, -1.0728, -0.2708, 
-0.825, 0.0739, 0.8085, 0.8602, 1.3676, -0.4863, 2.1234, -0.8973, 
-0.2006, -0.2972, 0.0494, 1.3275, 1.742, 1.2568, 0.5658, -0.8907, 
1.1019, -0.6784, -3.0089, -0.1071, -0.0348, 0.4956, -1.5965, 
-4.578, 2.0233, 1.8164, -0.8634, 0.1338, -1.6979, 1.2467, -0.3596, 
1.2227, -0.6044, -1.5277, -1.0158, 0.4926, 0.8544, 0.6129, 0.2976, 
0.3437, -0.6874, -0.1675, -0.8576, 1.4413, -0.4621, 0.9578, -1.2836, 
-0.8432, -1.3462, 1.5717, 0.9858, 0.3494, 0.2312, -0.8992, 0.7922, 
1.2108, 1.0855, -0.6685, 0.5451, -0.2918, 1.6725, -1.0919, 0.242, 
0.9622, -1.1156, -0.5224, -0.6458, 2.1272, -1.1929, 0.3822, -0.8822, 
-0.7896, -0.752, 0.2748, -0.6986, -0.6214, -0.0754, 0.7125, 2.1072, 
-3.2647, -2.1716, -2.6933, 1.4873, -0.1674, -0.7573, -2.3392, 
0.1607, 1.4757, 2.5337, 0.3551, 2.1733, -2.2058, 0.1276, 0.0814, 
0.7431, 2.6913, 0.4411, -1.0256, 0.676, -2.2243, 0.8293, -0.7375, 
1.1858, 0.6847, 1.2721, -2.0652, -3.1561, -2.1539, 0.1553, 0.3163, 
0.0641, -0.4027, -0.967, -0.5773, -0.3537, -0.3323, 0.3336, -0.0722, 
-0.006, -1.2042, -1.6331, 1.3997, -1.3688, 0.1338, -1.0674, -0.9948, 
-2.1507, 0.3999, -0.4026, -0.7439, -0.1672, 1.7708, -1.7547), 
    cluster = c(3L, 2L, 2L, 5L, 4L, 1L, 4L, 4L, 2L, 3L, 2L, 3L, 
    2L, 2L, 4L, 3L, 2L, 3L, 4L, 3L, 4L, 3L, 2L, 3L, 3L, 3L, 4L, 
    1L, 2L, 3L, 2L, 3L, 3L, 5L, 4L, 2L, 2L, 4L, 5L, 2L, 5L, 5L, 
    3L, 2L, 3L, 1L, 2L, 2L, 2L, 3L, 1L, 2L, 5L, 4L, 3L, 3L, 4L, 
    2L, 3L, 2L, 1L, 3L, 3L, 3L, 3L, 3L, 2L, 4L, 3L, 4L, 3L, 1L, 
    3L, 5L, 2L, 3L, 3L, 1L, 2L, 2L, 3L, 4L, 2L, 5L, 2L, 1L, 3L, 
    1L, 2L, 3L, 4L, 3L, 2L, 1L, 3L, 4L, 3L, 2L, 3L, 4L, 1L, 2L, 
    5L, 4L, 3L, 3L, 3L, 3L, 1L, 2L, 2L, 4L, 4L, 1L, 3L, 5L, 5L, 
    2L, 4L, 5L, 1L, 3L, 2L, 2L, 3L, 2L, 1L, 1L, 4L, 4L, 2L, 3L, 
    2L, 2L, 4L, 3L, 2L, 4L, 5L, 2L, 1L, 2L, 4L, 1L, 4L, 4L, 4L, 
    5L, 3L, 4L, 4L, 3L, 4L, 2L, 2L, 1L, 1L, 2L, 5L, 1L, 3L, 2L, 
    1L, 3L, 4L, 2L, 5L, 4L, 2L, 4L, 3L, 3L, 2L, 2L, 5L, 3L, 2L, 
    3L, 4L, 1L, 3L, 1L, 3L, 3L, 5L, 2L, 3L, 4L, 4L, 5L, 3L, 2L, 
    1L, 3L, 5L, 3L, 2L, 4L, 4L, 2L, 2L, 3L, 3L, 4L, 1L, 3L, 5L, 
    4L, 3L, 2L, 3L, 2L, 3L, 2L, 4L, 3L, 4L, 1L, 3L, 3L, 2L, 4L, 
    2L, 2L, 4L, 4L, 4L, 1L, 2L, 2L, 4L, 3L, 5L, 2L, 1L, 2L, 4L, 
    1L, 4L, 3L, 4L, 2L, 2L, 1L, 1L, 4L, 2L, 1L, 2L, 4L, 5L, 4L, 
    4L, 2L, 4L, 2L, 1L, 4L, 3L, 3L, 4L, 4L, 2L, 5L, 1L, 4L, 4L, 
    2L, 3L, 3L, 2L, 3L, 4L, 2L, 2L, 3L, 3L, 2L, 4L, 2L, 5L, 5L, 
    4L, 2L, 3L, 2L, 2L, 1L, 4L, 2L, 3L, 4L, 3L, 3L, 4L, 4L, 3L, 
    1L, 4L, 2L), brgroupnum = c(4L, 11L, 11L, 10L, 1L, 10L, 14L, 
    14L, 11L, 14L, 3L, 1L, 11L, 11L, 3L, 5L, 3L, 3L, 14L, 14L, 
    14L, 1L, 11L, 3L, 14L, 14L, 14L, 10L, 11L, 10L, 3L, 14L, 
    10L, 14L, 14L, 11L, 3L, 14L, 3L, 10L, 4L, 14L, 2L, 3L, 14L, 
    10L, 3L, 11L, 3L, 10L, 14L, 11L, 14L, 14L, 1L, 2L, 14L, 11L, 
    14L, 11L, 14L, 3L, 6L, 1L, 10L, 2L, 11L, 14L, 10L, 14L, 3L, 
    10L, 6L, 4L, 3L, 14L, 3L, 3L, 11L, 3L, 1L, 14L, 3L, 4L, 3L, 
    10L, 2L, 10L, 11L, 3L, 1L, 1L, 3L, 14L, 10L, 14L, 4L, 11L, 
    7L, 6L, 10L, 11L, 7L, 14L, 1L, 14L, 3L, 6L, 10L, 3L, 11L, 
    14L, 14L, 14L, 14L, 14L, 6L, 3L, 14L, 14L, 10L, 3L, 11L, 
    11L, 4L, 3L, 10L, 10L, 14L, 14L, 3L, 14L, 3L, 3L, 14L, 6L, 
    11L, 14L, 14L, 11L, 3L, 11L, 1L, 1L, 12L, 6L, 14L, 14L, 1L, 
    3L, 14L, 1L, 14L, 3L, 11L, 14L, 3L, 11L, 10L, 14L, 6L, 11L, 
    10L, 4L, 1L, 11L, 14L, 14L, 3L, 14L, 7L, 14L, 11L, 11L, 7L, 
    14L, 11L, 4L, 14L, 10L, 14L, 10L, 4L, 14L, 14L, 3L, 1L, 14L, 
    14L, 4L, 10L, 3L, 10L, 6L, 14L, 12L, 11L, 14L, 14L, 11L, 
    11L, 6L, 14L, 14L, 10L, 11L, 4L, 14L, 2L, 14L, 14L, 11L, 
    14L, 3L, 14L, 1L, 14L, 14L, 14L, 14L, 3L, 14L, 11L, 3L, 14L, 
    2L, 6L, 1L, 3L, 11L, 14L, 14L, 14L, 11L, 10L, 3L, 14L, 10L, 
    14L, 6L, 14L, 11L, 3L, 10L, 10L, 14L, 3L, 1L, 3L, 14L, 12L, 
    14L, 14L, 3L, 14L, 11L, 14L, 14L, 10L, 14L, 14L, 6L, 11L, 
    14L, 10L, 10L, 3L, 3L, 11L, 1L, 3L, 14L, 14L, 4L, 3L, 14L, 
    12L, 3L, 12L, 11L, 14L, 14L, 14L, 10L, 1L, 11L, 11L, 3L, 
    1L, 3L, 14L, 3L, 2L, 6L, 14L, 14L, 14L, 10L, 14L, 3L), brgroupttl = c("CA1", 
    "O N", "O N", "R", "O S1", "R", "O Br", "O Br", "O N", "O Br", 
    "O H", "O S1", "O N", "O N", "O H", "O Fr", "O H", "O H", 
    "O Br", "O Br", "O Br", "O S1", "O N", "O H", "O Br", "O Br", 
    "O Br", "R", "O N", "R", "O H", "O Br", "R", "O Br", "O Br", 
    "O N", "O H", "O Br", "O H", "R", "CA1", "O Br", "L4", "O H", 
    "O Br", "R", "O H", "O N", "O H", "R", "O Br", "O N", "O Br", 
    "O Br", "O S1", "L4", "O Br", "O N", "O Br", "O N", "O Br", 
    "O H", "Mr", "O S1", "R", "L4", "O N", "O Br", "R", "O Br", 
    "O H", "R", "Mr", "CA1", "O H", "O Br", "O H", "O H", "O N", 
    "O H", "O S1", "O Br", "O H", "CA1", "O H", "R", "L4", "R", 
    "O N", "O H", "O S1", "O S1", "O H", "O Br", "R", "O Br", 
    "CA1", "O N", "Pr", "Mr", "R", "O N", "Pr", "O Br", "O S1", 
    "O Br", "O H", "Mr", "R", "O H", "O N", "O Br", "O Br", "O Br", 
    "O Br", "O Br", "Mr", "O H", "O Br", "O Br", "R", "O H", 
    "O N", "O N", "CA1", "O H", "R", "R", "O Br", "O Br", "O H", 
    "O Br", "O H", "O H", "O Br", "Mr", "O N", "O Br", "O Br", 
    "O N", "O H", "O N", "O S1", "O S1", "Occ", "Mr", "O Br", 
    "O Br", "O S1", "O H", "O Br", "O S1", "O Br", "O H", "O N", 
    "O Br", "O H", "O N", "R", "O Br", "Mr", "O N", "R", "CA1", 
    "O S1", "O N", "O Br", "O Br", "O H", "O Br", "Pr", "O Br", 
    "O N", "O N", "Pr", "O Br", "O N", "CA1", "O Br", "R", "O Br", 
    "R", "CA1", "O Br", "O Br", "O H", "O S1", "O Br", "O Br", 
    "CA1", "R", "O H", "R", "Mr", "O Br", "Occ", "O N", "O Br", 
    "O Br", "O N", "O N", "Mr", "O Br", "O Br", "R", "O N", "CA1", 
    "O Br", "L4", "O Br", "O Br", "O N", "O Br", "O H", "O Br", 
    "O S1", "O Br", "O Br", "O Br", "O Br", "O H", "O Br", "O N", 
    "O H", "O Br", "L4", "Mr", "O S1", "O H", "O N", "O Br", 
    "O Br", "O Br", "O N", "R", "O H", "O Br", "R", "O Br", "Mr", 
    "O Br", "O N", "O H", "R", "R", "O Br", "O H", "O S1", "O H", 
    "O Br", "Occ", "O Br", "O Br", "O H", "O Br", "O N", "O Br", 
    "O Br", "R", "O Br", "O Br", "Mr", "O N", "O Br", "R", "R", 
    "O H", "O H", "O N", "O S1", "O H", "O Br", "O Br", "CA1", 
    "O H", "O Br", "Occ", "O H", "Occ", "O N", "O Br", "O Br", 
    "O Br", "R", "O S1", "O N", "O N", "O H", "O S1", "O H", 
    "O Br", "O H", "L4", "Mr", "O Br", "O Br", "O Br", "R", "O Br", 
    "O H")), .Names = c("PC1", "PC2", "PC3", "PC4", "cluster", 
"brgroupnum", "brgroupttl"), row.names = c(12L, 235L, 421L, 534L, 
344L, 579L, 112L, 940L, 236L, 708L, 246L, 339L, 234L, 253L, 854L, 
661L, 643L, 782L, 942L, 723L, 998L, 354L, 226L, 832L, 244L, 659L, 
180L, 545L, 94L, 610L, 804L, 147L, 485L, 80L, 946L, 656L, 631L, 
989L, 800L, 498L, 35L, 901L, 459L, 248L, 697L, 590L, 169L, 72L, 
670L, 497L, 48L, 749L, 220L, 979L, 319L, 469L, 959L, 364L, 928L, 
213L, 947L, 819L, 404L, 460L, 605L, 430L, 71L, 927L, 507L, 984L, 
833L, 562L, 397L, 40L, 780L, 702L, 818L, 853L, 426L, 688L, 474L, 
944L, 774L, 39L, 678L, 573L, 464L, 494L, 885L, 803L, 470L, 437L, 
264L, 925L, 565L, 691L, 19L, 420L, 2L, 398L, 503L, 204L, 50L, 
47L, 458L, 945L, 808L, 399L, 505L, 690L, 369L, 130L, 991L, 873L, 
735L, 886L, 382L, 687L, 127L, 888L, 517L, 794L, 613L, 105L, 10L, 
170L, 549L, 609L, 976L, 663L, 684L, 1003L, 683L, 628L, 934L, 
415L, 273L, 744L, 669L, 274L, 21L, 87L, 346L, 317L, 373L, 396L, 
113L, 297L, 475L, 768L, 910L, 318L, 111L, 796L, 428L, 903L, 842L, 
225L, 540L, 938L, 413L, 254L, 539L, 38L, 343L, 654L, 219L, 107L, 
644L, 139L, 51L, 709L, 277L, 240L, 33L, 705L, 268L, 14L, 142L, 
570L, 922L, 491L, 11L, 929L, 741L, 629L, 331L, 988L, 118L, 20L, 
486L, 78L, 569L, 392L, 859L, 5L, 224L, 201L, 971L, 57L, 650L, 
381L, 732L, 836L, 577L, 309L, 16L, 982L, 429L, 183L, 936L, 230L, 
165L, 74L, 969L, 444L, 986L, 912L, 863L, 159L, 805L, 933L, 616L, 
771L, 133L, 447L, 407L, 335L, 789L, 422L, 964L, 716L, 301L, 93L, 
594L, 835L, 999L, 522L, 121L, 611L, 135L, 751L, 785L, 560L, 581L, 
664L, 640L, 348L, 673L, 914L, 82L, 179L, 839L, 638L, 134L, 621L, 
860L, 665L, 488L, 733L, 119L, 380L, 314L, 288L, 512L, 493L, 758L, 
76L, 626L, 473L, 376L, 950L, 202L, 43L, 831L, 954L, 4L, 852L, 
375L, 152L, 887L, 862L, 879L, 525L, 351L, 270L, 229L, 844L, 330L, 
783L, 869L, 759L, 431L, 388L, 987L, 974L, 727L, 552L, 911L, 779L
), class = "data.frame")

命令:

library(cluster)
plotcluster(ctsubset[,1:4],ctsubset$cluster,cex=0.8,
        col = factor(ctsubset$brgroupnum),
        main="clusters and groups")
legend("bottomright", 
   legend = unique(ctsubset$brgroupttl),pch=19,
   cex=0.7, col=unique(factor(ctsubset$brgroupnum)))

我遇到的问题是颜色。如您所见,绿色、红色、黑色在图例中重复出现,我无法清楚地看到不同的组(由 编码$groupnum)。

我尝试过但没有成功的替代方案(因为我不太了解它们)正在使用(1)color brewer(2)colorRampPalette 和(3)grid.raster

我所关心的是能够在我的传奇和情节中看到颜色的良好区别。

4

1 回答 1

1

更改col=factor(ctsubset$brgroupnum)11 个值colors()

您可以使用我很久以前制作的代码查看颜色:

cores <- function() {

 par(mar=c(0,0,0,0),mgp=c(0,0,0))
 plot(c(0:24),type='n') 
 c <- 0

 mouse <- function(b, x, y) {
  x <- as.integer(x*26)
  y <- as.integer(y*26)
  print(colors()[(x+26*y) %% 657 + 1])
  return()
 } 
 k <- colours()[(1:26^2 - 1) %% 657 + 1]
 for (i in 1:26) {
  for (j in 1:26) {
   c <- c+1
   polygon(c(j,j,j-1,j-1),c(i,i-1,i-1,i)-1,col=k[(c-1) %% 657 + 1])
  }
 }
 getGraphicsEvent('Click on a colour!',onMouseDown=mouse)

}
cores()

您也可以使用rainbow(11).

于 2013-04-03T17:13:53.843 回答